124632024-12-18 09:50:45feheristvanHőségriadó (50 pont)cpp17Accepted 50/5023ms560 KiB
#include <iostream>
#include <vector>
#include <fstream>

using namespace std;

int main()
{
    int n, k, l, f;
    ifstream fin("szoveg.in");
    cin >> n >> k >> l >> f;
    int folotte = 0, alatta = 0, x;
    int hosegriado = 0;
    bool hoseg = false;
    for(int i = 0; i < n; i ++){
        cin >> x;
        if(x > f){
            alatta = 0;
            folotte ++;
        }
        else if(x < f){
            alatta ++;
            folotte = 0;
        } else {
            alatta = 0;
            folotte = 0;
        }
        if(alatta == l){
            folotte = 0;
            alatta = 0;
            hoseg = false;
        }
        if(folotte == k && !hoseg){
            hosegriado ++;
            hoseg = true;
        }
    }
    cout << hosegriado;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/023ms320 KiB
3Accepted2/21ms500 KiB
4Accepted2/21ms332 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted4/41ms320 KiB
9Accepted4/49ms404 KiB
10Accepted4/412ms404 KiB
11Accepted4/414ms404 KiB
12Accepted4/412ms556 KiB
13Accepted4/417ms400 KiB
14Accepted4/42ms320 KiB
15Accepted4/421ms400 KiB
16Accepted4/420ms404 KiB
17Accepted4/420ms560 KiB