127952024-12-31 13:00:41MrkzFasor (40)cpp17Wrong answer 0/401ms592 KiB
#include <iostream>
#include <fstream>
using namespace std;

int main() {
    ifstream f("fasor.in");
    int n, k;
    f>>n>>k;
    int h[n+1];
    for(int i=1;i<=n;i++){
        f>>h[i];
    }
    for(int i=1;i<=n;i++){
        bool b=1;
        for(int j=1;j<=k;j++){
            if(i-j>=1 && h[i-j]>h[i] && b==1){
                b=0;
            }
        }
        if(b==1){
            for(int j=1;j<=k;j++){
                if(i+j<=n && h[i+j]>h[i] && b==1){
                    b=0;
                }
            }
        }

        if(b==1){
            cout<<i<<endl;
            return 0;
        }
    }

    cout<<-1<<endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/01ms320 KiB
2Wrong answer0/01ms512 KiB
3Wrong answer0/21ms320 KiB
4Wrong answer0/21ms500 KiB
5Wrong answer0/21ms320 KiB
6Wrong answer0/21ms320 KiB
7Wrong answer0/21ms320 KiB
8Wrong answer0/21ms320 KiB
9Wrong answer0/21ms320 KiB
10Wrong answer0/21ms320 KiB
11Wrong answer0/21ms544 KiB
12Wrong answer0/21ms320 KiB
13Wrong answer0/21ms320 KiB
14Wrong answer0/21ms320 KiB
15Wrong answer0/21ms320 KiB
16Wrong answer0/21ms592 KiB
17Wrong answer0/21ms320 KiB
18Wrong answer0/21ms320 KiB
19Wrong answer0/21ms392 KiB
20Wrong answer0/21ms320 KiB
21Wrong answer0/21ms320 KiB
22Wrong answer0/21ms320 KiB