82672024-01-13 22:42:07zoliHőségriadó (50 pont)cpp17Accepted 50/5023ms4256 KiB
#include <iostream>
#include <fstream>
using namespace std;
short int a[100001];
short int k,l,f;
int n;
void be()
{
    //ifstream cin("be2.txt");
    cin>>n>>k>>l>>f;
    for(int i=1;i<=n;i++) cin>>a[i];
}

int main()
{
    be();
    int db=0; //hosegriadok szama
    int i=1;
    int dbkezd;
    while(i<=n)
    {
        dbkezd=0;
        while(i<=n&&a[i]<=f) i++;

        while(i<=n&&dbkezd<k)
            {
                if(a[i]>f) dbkezd++;
                else dbkezd=0;
                i++;
            }

        if(dbkezd>=k) /// hosegriado kezdodik
        {
            db++;

            int dblefuj=0;
            while(i<=n&&a[i]>=f) i++;
            while(i<=n&&dblefuj<l)
                {
                    if(a[i]<f)dblefuj++;
                    else dblefuj=0;
                    i++;
                }
        }
    }
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/023ms2568 KiB
3Accepted2/23ms2332 KiB
4Accepted2/23ms2568 KiB
5Accepted2/23ms2800 KiB
6Accepted2/23ms2988 KiB
7Accepted2/23ms3200 KiB
8Accepted4/43ms3244 KiB
9Accepted4/410ms3580 KiB
10Accepted4/413ms3780 KiB
11Accepted4/414ms4028 KiB
12Accepted4/413ms4080 KiB
13Accepted4/418ms4256 KiB
14Accepted4/44ms4080 KiB
15Accepted4/421ms4228 KiB
16Accepted4/421ms4224 KiB
17Accepted4/421ms4224 KiB