139032025-01-09 09:46:24BencuHőségriadó (50 pont)cpp17Accepted 50/5021ms820 KiB
#include <bits/stdc++.h>

using namespace std;
int n,k,l,f;
int a[100001],b[100001],s;
bool sz=0;

void be() {
    ifstream g("be.in");
    cin>>n>>k>>l>>f;
    int x;
    for (int i=1; i<=n; i++) {
        cin>>x;
        if (x>f) a[i]=a[i-1]+1;
        if (x<f) b[i]=b[i-1]+1;
    }
    /*for (int i=1; i<=n; i++) cout<<a[i]<<" ";
    cout<<endl;
    for (int i=1; i<=n; i++) cout<<b[i]<<" ";
    cout<<endl;*/
}

int main()
{
    be();
    for (int i=1; i<=n; i++) {
        if (a[i]>=k) {
            s++;
            sz=1;
            while (b[i]<l) i++;
        }
    }
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms508 KiB
2Accepted0/021ms820 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/49ms484 KiB
10Accepted4/412ms664 KiB
11Accepted4/414ms516 KiB
12Accepted4/412ms564 KiB
13Accepted4/417ms820 KiB
14Accepted4/42ms508 KiB
15Accepted4/419ms756 KiB
16Accepted4/420ms664 KiB
17Accepted4/419ms660 KiB