83142024-01-14 17:08:57TuruTamasHőségriadó (50 pont)cpp17Accepted 50/5010ms3564 KiB
#include <iostream>

using namespace std;

typedef long long ll;

ll N, K, L, F, a, r;
ll melegnap, hidegnap;
bool riado;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> N >> K >> L >> F;
    for (ll n = 0; n < N; n++) {
        cin >> a;
        if (a >= F) {
            hidegnap = 0;
        }
        if (a <= F) {
            melegnap = 0;
        }
        if (a > F) {
            melegnap++;
            if (!riado && melegnap == K) {
                r++;
                riado = true;
            }
        }
        else if (a < F) {
            hidegnap++;
            if (riado && hidegnap == L) {
                riado = false;
            }
        }
    }
    cout << r << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2072 KiB
2Accepted0/010ms2308 KiB
3Accepted2/23ms2528 KiB
4Accepted2/23ms2608 KiB
5Accepted2/23ms2840 KiB
6Accepted2/23ms2920 KiB
7Accepted2/23ms2940 KiB
8Accepted4/43ms3028 KiB
9Accepted4/46ms3024 KiB
10Accepted4/47ms3028 KiB
11Accepted4/48ms3028 KiB
12Accepted4/47ms3152 KiB
13Accepted4/48ms3236 KiB
14Accepted4/43ms3364 KiB
15Accepted4/49ms3564 KiB
16Accepted4/49ms3556 KiB
17Accepted4/49ms3532 KiB