194962025-12-11 10:23:04SzeredaiNatanaelHőségriadó (50 pont)cpp17Wrong answer 10/5023ms768 KiB
// hosegriado.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

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

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

    int db = 0, high = 0, low = 0;
    bool riado = false;
    for (int i = 1; i <= n; ++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
base10/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/023ms756 KiB
3Wrong answer0/21ms500 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/41ms316 KiB
9Wrong answer0/49ms572 KiB
10Wrong answer0/412ms608 KiB
11Wrong answer0/414ms656 KiB
12Wrong answer0/412ms572 KiB
13Wrong answer0/418ms728 KiB
14Accepted4/43ms332 KiB
15Wrong answer0/420ms768 KiB
16Wrong answer0/421ms764 KiB
17Accepted4/421ms764 KiB