82982024-01-14 11:55:54Balki22Hőségriadó (50 pont)cpp17Accepted 50/5024ms3812 KiB
#include <bits/stdc++.h>

using namespace std;
using ull = long long;

int main() {
    ull n, k, l, f; cin >> n >> k >> l >> f;

    int fent = 0;
    int lent = 0;
    ull r = 0;
    bool riado = false;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a > f) fent++;
        else fent = 0;
        if (a < f) lent++;
        else lent = 0;
        if (fent >= k && !riado) {
            riado = true;
            r++;
        }
        if (lent >= l && riado) {
            riado = false;
        }
    }
    cout << r;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/024ms2068 KiB
3Accepted2/23ms2428 KiB
4Accepted2/23ms2464 KiB
5Accepted2/23ms2516 KiB
6Accepted2/23ms2724 KiB
7Accepted2/23ms2936 KiB
8Accepted4/43ms3184 KiB
9Accepted4/410ms3228 KiB
10Accepted4/413ms3232 KiB
11Accepted4/416ms3476 KiB
12Accepted4/413ms3560 KiB
13Accepted4/419ms3516 KiB
14Accepted4/44ms3788 KiB
15Accepted4/421ms3784 KiB
16Accepted4/421ms3812 KiB
17Accepted4/421ms3672 KiB