125542024-12-22 20:48:57BucsMateHőségriadó (50 pont)cpp17Accepted 50/5021ms512 KiB
#include <iostream>

using namespace std;

int main()
{
    int N, K, L, F;
    int temp, nrAlarm = 0, above = 0, below = 0;
    bool isAlarm = false;

    cin >> N >> K >> L >> F;
    for(int i = 1; i <= N; i++){
        cin >> temp;
        if(temp > F){
            above++;
            below = 0;
        }
        else if(temp < F){
            above = 0;
            below++;
        }
        else{
            above = 0;
            below = 0;
        }

        if(below >= L){
            isAlarm = false;
        }
        if(above >= K && !isAlarm){
            nrAlarm++;
            isAlarm = true;
        }
    }
    cout << nrAlarm << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms512 KiB
2Accepted0/021ms408 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms512 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted4/41ms320 KiB
9Accepted4/48ms400 KiB
10Accepted4/410ms400 KiB
11Accepted4/414ms400 KiB
12Accepted4/412ms404 KiB
13Accepted4/417ms400 KiB
14Accepted4/42ms320 KiB
15Accepted4/419ms404 KiB
16Accepted4/419ms400 KiB
17Accepted4/420ms508 KiB