82512024-01-13 20:23:52szasztundeHőségriadó (50 pont)cpp17Accepted 50/5024ms4160 KiB
#include <iostream>
#include <fstream>

using namespace std;
/**
9 2 2 30
28 32 32 28 32 26 26 32 32 **/

int main()
{
    ///ifstream fin("be2.txt");
    int n,k,l,f,x,dbhr=0,dbf=0,dbl=0,elotte=0;
    cin>>n>>k>>l>>f;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        if(x>f) {
            dbf++; dbl=0;
            if(dbf==k and !elotte) {
                dbhr++;
                elotte=1;
            }
        }
        else if(x<f) {
            dbl++; dbf=0;
            if(dbl==l) elotte=0;
        }
        else { dbf=0; dbl=0; }
        //cout<<x<<" "<<elotte<<" dbf="<<dbf<<" dbl="<<dbl<<endl;
    }
    cout<<dbhr;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1872 KiB
2Accepted0/024ms2124 KiB
3Accepted2/23ms2332 KiB
4Accepted2/23ms2544 KiB
5Accepted2/23ms2740 KiB
6Accepted2/23ms2956 KiB
7Accepted2/23ms3160 KiB
8Accepted4/43ms3244 KiB
9Accepted4/410ms3528 KiB
10Accepted4/413ms3560 KiB
11Accepted4/416ms3700 KiB
12Accepted4/413ms3804 KiB
13Accepted4/419ms4052 KiB
14Accepted4/44ms4084 KiB
15Accepted4/421ms4136 KiB
16Accepted4/423ms4136 KiB
17Accepted4/423ms4160 KiB