223782026-01-14 22:44:20FintaTihamerFasor (40)cpp17Wrong answer 6/4072ms1112 KiB
/*#include <iostream>
#include <fstream>
using namespace std;
void ki(int y){
    if(y!=0) cout<<y+1;
    else cout<<-1;
}
int moz(){
    int n;
    int k;
    int a[200000];
    int j=0;
    int i=1;
    cin>>n>>k;
    int k1=k;
    for(int x=0; x<n; x++) cin>>a[x];
    while(i<n && k1>=0){
        if(a[i]>a[j] && k1>=0 && i>j) {j=i; k1=k;}
        k1--;
        i++;
    }
    return j;
}
int main()
{   //ki(moz());
    cout<<1;
    return 0;
}*/
#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;
            s++;
        }
        }
        else {s=1;
            while(s<=k && t==1){
                if(a[i]<a[i-s] || a[i]<a[i+s])t=0;
                s++;
            }
        }
        if(t==1)b=i+1;
        i+=k;
    }cout<<b;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base6/40
1Accepted0/01ms316 KiB
2Wrong answer0/04ms508 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/22ms316 KiB
8Wrong answer0/22ms512 KiB
9Accepted2/24ms416 KiB
10Wrong answer0/24ms316 KiB
11Wrong answer0/24ms384 KiB
12Wrong answer0/23ms316 KiB
13Wrong answer0/237ms804 KiB
14Wrong answer0/235ms548 KiB
15Wrong answer0/257ms1112 KiB
16Wrong answer0/268ms1008 KiB
17Wrong answer0/272ms988 KiB
18Wrong answer0/272ms1008 KiB
19Wrong answer0/271ms1000 KiB
20Wrong answer0/221ms564 KiB
21Wrong answer0/259ms984 KiB
22Wrong answer0/272ms1032 KiB