177862025-09-17 18:16:26algoproFasor (40)cpp17Wrong answer 2/40300ms1268 KiB
// UUID: af82bf9a-e9e7-4346-b092-ebae3f38f6a5
#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+k; c<=i+k-1; c++){
            if(a[c]>a[k]) d++;
        }
        if(d==0) b=i;
    }
    if(b!=-1) cout<<b-1;
    else cout<<-1;
}
SubtaskSumTestVerdictTimeMemory
base2/40
1Accepted0/01ms316 KiB
2Wrong answer0/04ms316 KiB
3Accepted2/21ms316 KiB
4Wrong answer0/21ms500 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/22ms316 KiB
9Wrong answer0/23ms432 KiB
10Wrong answer0/24ms316 KiB
11Wrong answer0/24ms316 KiB
12Wrong answer0/23ms368 KiB
13Time limit exceeded0/2300ms756 KiB
14Wrong answer0/235ms564 KiB
15Time limit exceeded0/2300ms1076 KiB
16Time limit exceeded0/2300ms1076 KiB
17Time limit exceeded0/2289ms1076 KiB
18Time limit exceeded0/2300ms1076 KiB
19Wrong answer0/2115ms1192 KiB
20Wrong answer0/220ms564 KiB
21Time limit exceeded0/2287ms1076 KiB
22Time limit exceeded0/2300ms1268 KiB