114202024-09-13 10:46:49madvirHőségriadó (50 pont)cpp17Accepted 50/5023ms504 KiB
#include <iostream>
#include <set>

using namespace std;
long long n,k,l,f, temp;
long long meleg=0, hideg=0, riado=0, card=0;

int main()
{
    cin >>n >>k >>l >> f;
    for(long long i=0; i<n; i++) {
        cin >> temp;
        if(temp==f) {
            hideg=0;
            meleg=0;
        }
        if(temp>f) {
            hideg=0;
            meleg++;
            if(meleg==k && riado==0) {
                riado=1;
                card++;
            }
        }
        else {
            meleg=0;
            if(temp<f) {
                hideg++;
                if(hideg==l && riado==1)  {
                    riado=0;
                }
            }
        }
    }
    cout<< card;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms360 KiB
2Accepted0/023ms360 KiB
3Accepted2/23ms360 KiB
4Accepted2/22ms404 KiB
5Accepted2/22ms368 KiB
6Accepted2/22ms384 KiB
7Accepted2/22ms376 KiB
8Accepted4/43ms360 KiB
9Accepted4/410ms496 KiB
10Accepted4/413ms504 KiB
11Accepted4/414ms272 KiB
12Accepted4/413ms264 KiB
13Accepted4/418ms504 KiB
14Accepted4/44ms232 KiB
15Accepted4/420ms416 KiB
16Accepted4/421ms384 KiB
17Accepted4/420ms452 KiB