139012025-01-09 09:38:27BencuHőségriadó (50 pont)cpp17Wrong answer 2/501ms508 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");
    g>>n>>k>>l>>f;
    int x;
    for (int i=1; i<=n; i++) {
        g>>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]<<" ";*/
}

int main()
{
    be();
    for (int i=1; i<=n; i++) {
        if (a[i]>=k && sz==0) {
            s++;
            sz=1;
        }
        if (b[i]>=l && sz==1) {
            sz=0;
        }
    }
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/01ms508 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms508 KiB
5Wrong answer0/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/41ms316 KiB
9Wrong answer0/41ms316 KiB
10Wrong answer0/41ms316 KiB
11Wrong answer0/41ms316 KiB
12Wrong answer0/41ms316 KiB
13Wrong answer0/41ms316 KiB
14Wrong answer0/41ms316 KiB
15Wrong answer0/41ms316 KiB
16Wrong answer0/41ms316 KiB
17Wrong answer0/41ms316 KiB