194862025-12-11 08:53:24SzeredaiNatanaelHőségriadó (50 pont)cpp17Runtime error 0/5034ms32000 KiB
// hosegriado.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <fstream>

using namespace std;

ifstream fin("be2.txt");
#define cin fin

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

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

    for (int i = 0; i < n; ++i) {
        cin >> ho[i];
    }

    int db = 0, high = 0, low = 0;
    bool riado = false;
    for (int i = 0; i < n; ++i) {
        if (ho[i] > f) {
            ++high;
            if (high > k && !riado) {
                ++db;
                riado = true;
            }
        }
        else if (ho[i] < f) {
            ++low;
            if (low > l && riado) riado = false;
        }
        else if (ho[i] == f) {
            high = 0; low = 0;
        }
    }

    cout << db << endl;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/028ms32000 KiB
2Runtime error0/034ms32000 KiB
3Runtime error0/232ms32000 KiB
4Runtime error0/228ms32000 KiB
5Runtime error0/232ms32000 KiB
6Runtime error0/227ms32000 KiB
7Runtime error0/232ms32000 KiB
8Runtime error0/428ms32000 KiB
9Runtime error0/427ms32000 KiB
10Runtime error0/432ms32000 KiB
11Runtime error0/432ms32000 KiB
12Runtime error0/426ms32000 KiB
13Runtime error0/434ms32000 KiB
14Runtime error0/426ms32000 KiB
15Runtime error0/432ms32000 KiB
16Runtime error0/427ms32000 KiB
17Runtime error0/426ms32000 KiB