178052025-09-17 18:30:16algoproFasor (40)cpp17Wrong answer 0/40300ms1260 KiB
// UUID: 285546b6-441a-4e6f-a1f6-a28b9c8c004d
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n,k,b=-1;
    cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    for(int i=k; i<n-k-1; i++){
        int d=0;
        for(int j=i-k; j<k; j++){
            if(a[j]>a[k]) d++;
        }
        for(int c=i; c<i+k; c++){
            if(a[c]>a[k]) d++;
        }
        if(d==0){ 
            b=i;
            break;
        }
    }
    if(b!=-1) cout<<b+1;
    else cout<<-1;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/01ms500 KiB
2Wrong answer0/06ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms508 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/22ms408 KiB
9Wrong answer0/24ms376 KiB
10Wrong answer0/26ms432 KiB
11Wrong answer0/26ms316 KiB
12Wrong answer0/24ms316 KiB
13Time limit exceeded0/2300ms748 KiB
14Wrong answer0/234ms800 KiB
15Time limit exceeded0/2300ms1076 KiB
16Time limit exceeded0/2298ms1076 KiB
17Time limit exceeded0/2282ms1260 KiB
18Time limit exceeded0/2272ms1080 KiB
19Time limit exceeded0/2300ms1080 KiB
20Wrong answer0/221ms564 KiB
21Time limit exceeded0/2300ms1080 KiB
22Time limit exceeded0/2300ms1076 KiB