119992024-11-24 15:42:35ruffbrigiHőségriadó (50 pont)cpp17Accepted 50/5023ms604 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,k,l,f;
    cin>>n;
    cin>>k;
    cin>>l;
    cin>>f;
    int a[n];
    for(int i=0;i<=n-1;i++)
    {
        cin>>a[i];
    }
    int dbk=0,dbl=0,hr=0;
    bool hr2=false;
    for(int i=0;i<=n-1;i++)
    {
        if(a[i]>f)
        {
            dbk++;
            dbl=0;
            if(dbk==k)
            {
                if(hr2==false)
                {
                    hr2=true;
                    hr++;
                }
            }
        }
        else if(a[i]<f)
            {
                dbl++;
                dbk=0;
                if(dbl==l)
                {
                    hr2=false;
                }
            }
            else
                {
                    dbl=0;
                    dbk=0;
                }
    }
    cout<<hr;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/023ms568 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted4/41ms560 KiB
9Accepted4/49ms320 KiB
10Accepted4/412ms520 KiB
11Accepted4/414ms392 KiB
12Accepted4/412ms568 KiB
13Accepted4/417ms604 KiB
14Accepted4/42ms320 KiB
15Accepted4/420ms584 KiB
16Accepted4/420ms568 KiB
17Accepted4/420ms568 KiB