85642024-01-22 07:19:04bzsofiaHőségriadó (50 pont)cpp14Accepted 50/5010ms3584 KiB
// Proba.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
//#include <fstream>

#define ll long long

using namespace std;

//ifstream fin("hoseg.in");
//ofstream fout("hoseg.out");

ll n, K, L, F, alacsony, db, magas, a, i;
bool ho;

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

    cin >> n >> K >> L >> F;

    for (i = 1; i <= n; ++i)
    {
        cin >> a;

        if (a > F)
        {
            ++magas;
            if (magas == K && !ho)
            {
                ho = 1;
                ++db;
            }
        }
        else magas = 0;

        if (a < F)
        {
            ++alacsony;
            if (alacsony >= L)
            {
                ho = 0;
            }
        }
        else alacsony = 0;
    }

    cout << db;

    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2044 KiB
2Accepted0/010ms2268 KiB
3Accepted2/23ms2516 KiB
4Accepted2/23ms2516 KiB
5Accepted2/23ms2648 KiB
6Accepted2/23ms2864 KiB
7Accepted2/23ms2944 KiB
8Accepted4/43ms2952 KiB
9Accepted4/46ms3308 KiB
10Accepted4/47ms3204 KiB
11Accepted4/48ms3424 KiB
12Accepted4/47ms3388 KiB
13Accepted4/48ms3488 KiB
14Accepted4/43ms3560 KiB
15Accepted4/49ms3352 KiB
16Accepted4/49ms3480 KiB
17Accepted4/410ms3584 KiB