220132026-01-14 12:43:53BDavid5616Fasor (40)cpp11Wrong answer 8/40300ms1076 KiB
#include <iostream>
using namespace std;
int main()
{int i,s,t,b,a[200000],n,k;
    cin>>n>>k;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    b=-1;i=0;
    while(i<n && b==-1){t=1;s=1;
        if(i+k<n && i-k<=0){while(s<=k && t==1){
            if(a[i]<a[i+s])t=0;
            if(i+s>=n || i-s<0)t=0;
            s++;
        }
        }
        else {s=1;
            while(s<=k && t==1){
                if(a[i]<a[i-s] || a[i]<a[i+s])t=0;
                if(i+s>=n || i-s<0)t=0;
                s++;
            }
        }
        if(t==1)b=i+1;
        i++;
    }cout<<b;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/40
1Accepted0/01ms316 KiB
2Accepted0/04ms332 KiB
3Wrong answer0/21ms508 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms324 KiB
8Accepted2/22ms408 KiB
9Wrong answer0/24ms316 KiB
10Accepted2/24ms384 KiB
11Accepted2/24ms432 KiB
12Wrong answer0/23ms316 KiB
13Time limit exceeded0/2300ms764 KiB
14Time limit exceeded0/2300ms564 KiB
15Time limit exceeded0/2300ms1024 KiB
16Time limit exceeded0/2300ms1004 KiB
17Time limit exceeded0/2277ms968 KiB
18Time limit exceeded0/2279ms1076 KiB
19Time limit exceeded0/2280ms1076 KiB
20Time limit exceeded0/2280ms564 KiB
21Time limit exceeded0/2291ms1076 KiB
22Wrong answer0/272ms1076 KiB