215052026-01-13 10:53:42badamHőségriadó (50 pont)cpp17Accepted 50/5021ms620 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, K, L, F;
    int mostsok=0, mostkeves=0, szamlalo=0;
    bool elozo, hosegriado=0;
    cin >> n >> K >> L >> F;
    int t[n];
    for(int i=0; i<n; i++) cin >> t[i];
    for(int i=0; i<n; i++)
    {
        if(t[i]>F and hosegriado==false)
        {
            mostsok++;
            mostkeves=0;
        }
        if(t[i]<F and hosegriado==false) mostsok=0;
        if(t[i]<F and hosegriado==true)
        {
            mostkeves++;
        }
        if(t[i]>F and hosegriado==true)
        {
            mostkeves=0;
            mostsok++;
        }
        if(t[i]==F and hosegriado==true)
        {
            mostkeves=0;
        }
        if(t[i]==F and hosegriado==false) mostsok=0;
        elozo=hosegriado;
        if(mostsok>=K) hosegriado=true;
        if(mostkeves>=L) hosegriado=false, mostsok=0, mostkeves=0;
        if(elozo==false and hosegriado==true) szamlalo++;

    }
    cout << szamlalo;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/021ms564 KiB
3Accepted2/21ms520 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/48ms316 KiB
10Accepted4/410ms540 KiB
11Accepted4/414ms500 KiB
12Accepted4/410ms492 KiB
13Accepted4/417ms564 KiB
14Accepted4/42ms544 KiB
15Accepted4/419ms560 KiB
16Accepted4/419ms620 KiB
17Accepted4/419ms548 KiB