91912024-02-17 19:42:28MrChipserHőségriadó (50 pont)cpp17Accepted 50/5024ms4120 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, k,l,f;
    cin >> n >>k >> l >> f;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    bool riado = false;
    int rsz = 0;
    int felett = 0;
    int alatt = 0;
    for(int i = 0; i < n; i++)
    {
        if(!riado)
        {
            if(a[i]>f)
                felett++;
            else
                felett=0;
            if(felett==k)
            {
                riado = true;
                felett = 0;
                rsz++;
                //cout << i << endl;
            }
        }
        else
        {
            if(a[i]<f)
                alatt++;
            else
                alatt = 0;
            if(alatt==l)
            {
                riado = false;
                alatt = 0;
                //cout << i<<endl;
            }
        }
    }
    cout << rsz;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/024ms2900 KiB
3Accepted2/23ms2340 KiB
4Accepted2/23ms2548 KiB
5Accepted2/23ms2780 KiB
6Accepted2/23ms2956 KiB
7Accepted2/23ms3024 KiB
8Accepted4/43ms2944 KiB
9Accepted4/410ms3608 KiB
10Accepted4/414ms3852 KiB
11Accepted4/416ms3952 KiB
12Accepted4/413ms3700 KiB
13Accepted4/419ms3948 KiB
14Accepted4/44ms3180 KiB
15Accepted4/423ms4120 KiB
16Accepted4/423ms4080 KiB
17Accepted4/423ms4096 KiB