85642024-01-22 07:19:04bzsofiaHőségriadó (50 pont)cpp14Elfogadva 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/03ms2044 KiB
2Elfogadva0/010ms2268 KiB
3Elfogadva2/23ms2516 KiB
4Elfogadva2/23ms2516 KiB
5Elfogadva2/23ms2648 KiB
6Elfogadva2/23ms2864 KiB
7Elfogadva2/23ms2944 KiB
8Elfogadva4/43ms2952 KiB
9Elfogadva4/46ms3308 KiB
10Elfogadva4/47ms3204 KiB
11Elfogadva4/48ms3424 KiB
12Elfogadva4/47ms3388 KiB
13Elfogadva4/48ms3488 KiB
14Elfogadva4/43ms3560 KiB
15Elfogadva4/49ms3352 KiB
16Elfogadva4/49ms3480 KiB
17Elfogadva4/410ms3584 KiB