82352024-01-13 18:47:00rennHőségriadó (50 pont)cpp17Wrong answer 2/5010ms4080 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(0);

    int n, riadnap, lemondnap, f;
    cin >> n >> riadnap >> lemondnap >> f;

    int riadok = 0;

    int curr;
    bool vesz = false, riasztas = false;

    int sorlenr = 0, sorlenl = 0;

    while(n--)
    {
        cin >> curr;
        if(curr == f)
        {
            sorlenr = sorlenl = 0;
            continue;
        }
        vesz = curr > f;

        if(vesz)
        {
            sorlenr++;
            sorlenl = 0;

            if(sorlenr == riadnap && !riasztas)
            {
                riasztas = true;
                riadok++;
            }
        }
        else
        {
            sorlenl++;
            sorlenr = 0;

            riasztas = !(sorlenl == lemondnap && riasztas);
        }
    }

    cout << riadok << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/03ms1892 KiB
2Wrong answer0/010ms2232 KiB
3Wrong answer0/23ms2348 KiB
4Wrong answer0/23ms2516 KiB
5Wrong answer0/23ms2752 KiB
6Accepted2/23ms2820 KiB
7Wrong answer0/23ms2912 KiB
8Wrong answer0/43ms3260 KiB
9Wrong answer0/46ms3364 KiB
10Wrong answer0/47ms3364 KiB
11Wrong answer0/48ms3616 KiB
12Wrong answer0/47ms3624 KiB
13Wrong answer0/49ms3884 KiB
14Wrong answer0/43ms3784 KiB
15Wrong answer0/410ms4000 KiB
16Wrong answer0/410ms4080 KiB
17Wrong answer0/410ms4040 KiB