110282024-06-21 12:10:53CsongiHőségriadó (50 pont)cpp17Accepted 50/5024ms548 KiB
#include <iostream>

using namespace std;

long long n, k, l, f, temp, riadok;
long long melegnap, hidegnap;
bool riado;

int main()
{
    cin >> n >> k >> l >> f;
    for (long long i = 0; i < n; i++) {
        cin >> temp;
        if (temp >= f) {
            hidegnap = 0;
        }
        if (temp <= f) {
            melegnap = 0;
        }
        if (temp > f) {
            melegnap++;
            if (!riado && melegnap == k) {
                riadok++;
                riado = true;
            }
        }
        else if (temp < f) {
            hidegnap++;
            if (riado && hidegnap == l) {
                riado = false;
            }
        }
    }
    cout << riadok << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms548 KiB
2Accepted0/024ms500 KiB
3Accepted2/23ms440 KiB
4Accepted2/23ms392 KiB
5Accepted2/23ms504 KiB
6Accepted2/22ms504 KiB
7Accepted2/22ms364 KiB
8Accepted4/43ms380 KiB
9Accepted4/410ms504 KiB
10Accepted4/414ms528 KiB
11Accepted4/416ms492 KiB
12Accepted4/414ms504 KiB
13Accepted4/419ms256 KiB
14Accepted4/44ms384 KiB
15Accepted4/423ms272 KiB
16Accepted4/423ms376 KiB
17Accepted4/423ms504 KiB