200012025-12-30 22:35:53szabelrHőségriadó (50 pont)cpp17Accepted 50/508ms500 KiB
// Hőségriadó_cleancpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k,l,f;
    cin >> n >> k >> l >> f;
    bool riado = false;
    int streak = 0;
    int riadok=0;
    for (int i = 0; i < n; i++)
    {
        int x; cin >> x;
        if (!riado)
        {
            if (x > f)
                streak++;
            else
                streak = 0;
            if (streak == k)
            {
                streak = 0;
                riado = true;
                riadok++;
                //break;
                
            }
        }
        else {
            if (x < f)
                streak++;
            else
                streak = 0;
            if (streak == l)
            {
                streak = 0;
                riado = false;
            }
        }
    }
    cout << riadok;
}

// 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/01ms316 KiB
2Accepted0/08ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms500 KiB
7Accepted2/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/44ms420 KiB
10Accepted4/44ms420 KiB
11Accepted4/44ms316 KiB
12Accepted4/44ms316 KiB
13Accepted4/47ms420 KiB
14Accepted4/42ms316 KiB
15Accepted4/48ms424 KiB
16Accepted4/48ms424 KiB
17Accepted4/48ms316 KiB