214812026-01-13 10:20:59gkataHőségriadó (50 pont)cpp17Elfogadva 50/5023ms508 KiB


// hosegriado.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#define ll long long

using namespace std;

bool ok = false;
ll k, l, f, n, i, a, db1, db2, db;

int main()
{
    cin >> n >> k >> l >> f;

    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        
        if (a > f)
        {
            ++db1;
            db2 = 0;
        }

        else if (a < f)
        {
            ++db2;
            db1 = 0;
        }

        else
        {
            db1 = 0;
            db2 = 0;
        }

        if (db1 >= k && ok == false)
        {
            ++db;
            ok = true;
        }

        else if (db2 >= l && ok == true) ok = false;
    }

    cout << db;

}

// 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/02ms316 KiB
2Elfogadva0/023ms316 KiB
3Elfogadva2/22ms316 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms316 KiB
7Elfogadva2/21ms332 KiB
8Elfogadva4/41ms316 KiB
9Elfogadva4/49ms404 KiB
10Elfogadva4/412ms352 KiB
11Elfogadva4/414ms508 KiB
12Elfogadva4/412ms396 KiB
13Elfogadva4/418ms500 KiB
14Elfogadva4/42ms316 KiB
15Elfogadva4/420ms392 KiB
16Elfogadva4/421ms400 KiB
17Elfogadva4/420ms396 KiB