194982025-12-11 10:25:53SzeredaiNatanaelHőségriadó (50 pont)cpp17Accepted 50/509ms820 KiB
// hosegriado.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k, l, f; cin >> n >> k >> l >> f;
    vector<int>ho(n + 1);

    int db = 0, high = 0, low = 0;
    bool riado = false;
    for (int i = 1; i <= n; ++i) {
        cin >> ho[i];

        if (ho[i] > f) {
            ++high;
            low = 0;
        }
        else if (ho[i] < f) {
            ++low;
            high = 0;
        }
        else {
            high = 0; low = 0;
        }

        if (high >= k && riado!=true) {
            ++db;
            riado = true;
        }
        else if (low >= l && riado==true) riado = false;
    }

    cout << db << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/08ms820 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms500 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/44ms348 KiB
10Accepted4/44ms636 KiB
11Accepted4/46ms668 KiB
12Accepted4/44ms752 KiB
13Accepted4/48ms752 KiB
14Accepted4/42ms316 KiB
15Accepted4/48ms792 KiB
16Accepted4/49ms788 KiB
17Accepted4/48ms564 KiB