204532026-01-06 18:50:58ZsoltHőségriadó (50 pont)cpp17Accepted 50/5021ms404 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,l,f;
    cin>>n>>k>>l>>f;
    bool r=false;
    int x,db=0,h=0,j=0;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        if(x>f)
        {
            h++;
            j=0;
            if(h==k && !r)
            {
                r=true;
                db++;
            }
        }
        else
        {
            if(x<f)
            {
                h=0;
                j++;
                if(j==l && r)
                {
                    r=false;
                }
            }
            else
            {
                h=0;
                j=0;
            }
        }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/021ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/48ms396 KiB
10Accepted4/412ms324 KiB
11Accepted4/414ms316 KiB
12Accepted4/410ms324 KiB
13Accepted4/417ms396 KiB
14Accepted4/42ms316 KiB
15Accepted4/419ms316 KiB
16Accepted4/419ms404 KiB
17Accepted4/419ms400 KiB