68502023-12-19 11:40:29madvirFasor (40)cpp17Wrong answer 10/40300ms5348 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int x, a[n+1];

    for(int i=1; i<=n; i++) {
        cin >> a[i];
    }

    bool kis=true, end1=false;

    x=k+1;
    while(x<n-k && !end1) {
        kis=true;
        for(int i=x-k; i<=x+k && kis && i>0 && i<=n; i++) {
            if(a[i]>a[x]) kis=false;
        }
        if(kis) end1=true;
        x++;
    }

    if(kis) {
        cout << --x;
    }
    else {
        cout << -1;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/40
1Accepted0/03ms1872 KiB
2Accepted0/04ms2232 KiB
3Wrong answer0/23ms2284 KiB
4Wrong answer0/23ms2488 KiB
5Wrong answer0/23ms2608 KiB
6Accepted2/23ms2676 KiB
7Wrong answer0/23ms2672 KiB
8Accepted2/23ms2680 KiB
9Wrong answer0/24ms2708 KiB
10Accepted2/26ms3056 KiB
11Accepted2/26ms3132 KiB
12Wrong answer0/24ms3480 KiB
13Time limit exceeded0/2300ms3136 KiB
14Wrong answer0/239ms4288 KiB
15Time limit exceeded0/2275ms3452 KiB
16Time limit exceeded0/2256ms3692 KiB
17Time limit exceeded0/2261ms3636 KiB
18Time limit exceeded0/2268ms3616 KiB
19Time limit exceeded0/2256ms3656 KiB
20Accepted2/223ms4440 KiB
21Time limit exceeded0/2259ms3708 KiB
22Wrong answer0/275ms5348 KiB