82362024-01-13 18:47:46rennHőségriadó (50 pont)cpp17Wrong answer 6/5010ms3328 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;

            if(sorlenr == lemondnap && riasztas)
            {
                riasztas = false;
            }
        }
    }

    cout << riadok << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base6/50
1Wrong answer0/03ms1892 KiB
2Wrong answer0/010ms2124 KiB
3Wrong answer0/23ms2604 KiB
4Wrong answer0/23ms2528 KiB
5Accepted2/23ms2664 KiB
6Accepted2/23ms2880 KiB
7Accepted2/23ms2952 KiB
8Wrong answer0/43ms3020 KiB
9Wrong answer0/46ms3020 KiB
10Wrong answer0/47ms3016 KiB
11Wrong answer0/48ms3020 KiB
12Wrong answer0/47ms3152 KiB
13Wrong answer0/48ms3236 KiB
14Wrong answer0/43ms3232 KiB
15Wrong answer0/49ms3328 KiB
16Wrong answer0/49ms3324 KiB
17Wrong answer0/49ms3240 KiB