223562026-01-14 21:58:43FintaTihamerFasor (40)cpp17Wrong answer 0/4075ms1164 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 moz2(){
    int n;
    int k;
    int a[200000];
    int j=0;
    cin>>n>>k;
    int k1=0;
    for(int x=0; x<n; x++) cin>>a[x];
    for(int i=1; i<n; i++){
        while(k1<=k && i+k<n){
            if(a[i+k]>a[j]) j=i;
            k1++;
        }
    }
    return j;
}
int main()
{   //ki(moz());
    ki(moz2());
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/01ms500 KiB
2Wrong answer0/04ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms332 KiB
8Wrong answer0/22ms404 KiB
9Wrong answer0/24ms416 KiB
10Wrong answer0/24ms324 KiB
11Wrong answer0/24ms316 KiB
12Wrong answer0/23ms324 KiB
13Wrong answer0/237ms700 KiB
14Wrong answer0/234ms792 KiB
15Wrong answer0/259ms1160 KiB
16Wrong answer0/267ms1004 KiB
17Wrong answer0/275ms1072 KiB
18Wrong answer0/275ms1076 KiB
19Wrong answer0/274ms1076 KiB
20Wrong answer0/221ms564 KiB
21Wrong answer0/261ms1076 KiB
22Wrong answer0/272ms1164 KiB