218052026-01-14 08:09:08bombinigusiniHőségriadó (50 pont)pypy3Runtime error 0/5078ms22804 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, k, l, f, hosegszam=0;
    cin>>n>>k>>l>>f;
    bool riado=false;
    int t[n];
    int sorozatnagy=0, sorozatkicsi=0;
    for(int i=0; i<n; i++)
    {
        cin>>t[i];
        if(riado==false)
        {
            if(t[i]>f)
            {
                sorozatnagy++;
                sorozatkicsi=0;
            }
            if(t[i]<f)
            {
                sorozatnagy=0;
                sorozatkicsi++;
            }
            if(t[i]==f) {sorozatkicsi=0; sorozatnagy=0;}
            if(sorozatnagy==k)
            {
                riado=true;
                hosegszam++;
            }
        }
        if(riado==true)
        {
            if(t[i]>f)
            {
                sorozatnagy++;
                sorozatkicsi=0;
            }
            if(t[i]<f)
            {
                sorozatnagy=0;
                sorozatkicsi++;
            }
            if(t[i]==f) {sorozatkicsi=0; sorozatnagy=0;}
            if(sorozatkicsi==l)
            {
                riado=false;
            }
        }
    }
    cout<<hosegszam;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/071ms22700 KiB
2Runtime error0/064ms22748 KiB
3Runtime error0/272ms22700 KiB
4Runtime error0/264ms22632 KiB
5Runtime error0/272ms22652 KiB
6Runtime error0/265ms22744 KiB
7Runtime error0/278ms22772 KiB
8Runtime error0/464ms22760 KiB
9Runtime error0/472ms22804 KiB
10Runtime error0/464ms22740 KiB
11Runtime error0/464ms22708 KiB
12Runtime error0/471ms22756 KiB
13Runtime error0/465ms22664 KiB
14Runtime error0/472ms22716 KiB
15Runtime error0/464ms22756 KiB
16Runtime error0/472ms22764 KiB
17Runtime error0/471ms22756 KiB