220182026-01-14 12:46:57szentedFasor (40)cpp17Wrong answer 12/40300ms1116 KiB
#include <iostream>
//#include <fstream>

using namespace std;

int vizsgal(int a[200000], int n, int k){
    for(int i=0; i<k; i++){
        int j=0;
        while(j<k && a[i]>=a[j]) j++;
        if(j>=k) return i+1;
    }
    for(int i=n-k; i<n; i++){
        int j=0;
        while(j<k && a[i]>=a[j]) j++;
        if(j>=k) return i+1;
    }
    for(int i=k; i<n-k; i++){
        int x=1;
        while(x<=k && a[i]>=a[i-x] && a[i]>=a[i+x]) x++;
        if(x>k) return i+1;
    }
}

int main()
{
    //ifstream f("be.in");
    int n;
    int k;
    //f >> n;
    //f >> k;
    cin >> n;
    cin >> k;
    int b[200000];

    for(int i=0; i<n; i++){
        //f >> b[i];
        cin >> b[i];
    }

    cout << vizsgal(b,n,k);
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base12/40
1Wrong answer0/02ms316 KiB
2Wrong answer0/04ms316 KiB
3Accepted2/22ms316 KiB
4Wrong answer0/21ms508 KiB
5Accepted2/21ms500 KiB
6Wrong answer0/21ms316 KiB
7Accepted2/21ms316 KiB
8Wrong answer0/22ms316 KiB
9Accepted2/24ms348 KiB
10Wrong answer0/24ms500 KiB
11Wrong answer0/24ms316 KiB
12Accepted2/23ms316 KiB
13Wrong answer0/283ms688 KiB
14Time limit exceeded0/2300ms740 KiB
15Time limit exceeded0/2300ms1108 KiB
16Time limit exceeded0/2298ms1012 KiB
17Time limit exceeded0/2284ms1000 KiB
18Time limit exceeded0/2275ms1076 KiB
19Wrong answer0/279ms1088 KiB
20Time limit exceeded0/2275ms544 KiB
21Time limit exceeded0/2282ms1116 KiB
22Accepted2/270ms1076 KiB