181272025-10-01 15:57:26KristófHőségriadó (50 pont)cpp17Elfogadva 50/508ms552 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/08ms508 KiB
3Elfogadva2/21ms508 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms340 KiB
6Elfogadva2/21ms320 KiB
7Elfogadva2/21ms316 KiB
8Elfogadva4/41ms500 KiB
9Elfogadva4/44ms316 KiB
10Elfogadva4/44ms316 KiB
11Elfogadva4/46ms420 KiB
12Elfogadva4/44ms552 KiB
13Elfogadva4/47ms316 KiB
14Elfogadva4/42ms392 KiB
15Elfogadva4/48ms428 KiB
16Elfogadva4/48ms424 KiB
17Elfogadva4/48ms316 KiB