181282025-10-01 15:57:45KristófHőségriadó (50 pont)cpp17Elfogadva 50/5021ms508 KiB
#include <iostream>
#include <bits/stdc++.h>
#include <cstdio>

using namespace std;

int main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    int n;
    int l,k;
    int f;
    cin>>n>>k>>l>>f;
    int i=0;
    int tmp;
    int cnthoseg=0;
    int cnthuseg=0;
    int meg=0;
    for(;i<n;i++)
        {
        cin>>tmp;
        if(tmp>f)
            {
            cnthoseg++;
            }
        else
            {
            cnthoseg=0;
            }
        if(cnthoseg==k)
            {
            //cout<<meg<<endl;
            meg++;
            i++;
            while(cnthuseg<l && i<n)
                {
                cin>>tmp;
                if(tmp<f)
                    {
                    cnthuseg++;
                    
                    if(cnthuseg==l)
                        {
                        break;
                        }
                    }
                else
                    {
                    cnthuseg=0;
                    }
                i++;
                //cout<<tmp<<" while "<<i<<endl;
                }
            cnthoseg=0;
            cnthuseg=0;
            }
        //cout<<tmp<<" for "<<i<<endl;
        }
    cout<<meg;
    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms316 KiB
2Elfogadva0/021ms416 KiB
3Elfogadva2/21ms316 KiB
4Elfogadva2/21ms320 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms316 KiB
7Elfogadva2/21ms316 KiB
8Elfogadva4/41ms316 KiB
9Elfogadva4/48ms404 KiB
10Elfogadva4/410ms400 KiB
11Elfogadva4/414ms316 KiB
12Elfogadva4/410ms396 KiB
13Elfogadva4/417ms316 KiB
14Elfogadva4/43ms508 KiB
15Elfogadva4/419ms400 KiB
16Elfogadva4/419ms396 KiB
17Elfogadva4/419ms400 KiB