98652024-03-13 15:45:49VargusHőségriadó (50 pont)cpp17Accepted 50/5024ms4792 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

ll db;
int main()
{
    ll n, k, l, f;
    cin >> n >> k >> l >> f;
    vector <ll> a(n+1);
    for (ll i = 1; i <= n; ++i)
    {
        cin >> a[i];
    }
    bool k1 = false, l1 = true;
    for (ll i = 1; i <= n; ++i)
    {
        if (k1 == 1)
        {
            for (ll j = i; j <= (i + l) - 1; ++j)
            {
                if (a[j] < f)
                {
                    l1 = true;
                }
                else
                {
                    l1 = false;
                    break;
                }
            }
            if (l1 == 1)
            {
                k1 = false;
                i += l - 1;
            }
        }
        if (a[i] > f && l1 == 1)
        {
            for (ll j = i; j <= (i + k) - 1; ++j)
            {
                if (a[j] > f)
                    k1 = true;
                else
                {
                    k1 = false;
                    break;
                }
            }
            if (k1 == 1)
            {
                ++db;
                i += k - 1;
            }
        }
    }
    cout << db;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/024ms3412 KiB
3Accepted2/23ms2264 KiB
4Accepted2/22ms2300 KiB
5Accepted2/23ms2428 KiB
6Accepted2/22ms2544 KiB
7Accepted2/23ms2940 KiB
8Accepted4/43ms3076 KiB
9Accepted4/410ms3372 KiB
10Accepted4/413ms3820 KiB
11Accepted4/416ms3856 KiB
12Accepted4/413ms3868 KiB
13Accepted4/419ms4376 KiB
14Accepted4/44ms3300 KiB
15Accepted4/423ms4536 KiB
16Accepted4/423ms4792 KiB
17Accepted4/423ms4684 KiB