205052026-01-07 13:21:53pirosmacska10Fasor (40)cpp17Runtime error 0/40300ms1368 KiB
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

using ll = long long;
const int MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;
    vector<int> nums(n);
    for(int i = 0; i < n; i++) {
        cin >> nums[i];
    }

    for(int i = 0; i < n; i++) {
        bool can = 1;
        for(int j = (i-k >= 0) ? i-k : 0; j <= i+k && j < n; j++) {
            if(nums[i] < nums[j]) {
                can = 0;
                break;
            }
        }
        if(can) {
            cout << i+1 << "\n";
            return 1;
        }
    }
    cout << "-1\n";
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Runtime error0/01ms316 KiB
2Runtime error0/02ms316 KiB
3Runtime error0/21ms316 KiB
4Runtime error0/21ms316 KiB
5Runtime error0/21ms500 KiB
6Runtime error0/21ms388 KiB
7Runtime error0/21ms320 KiB
8Runtime error0/21ms316 KiB
9Runtime error0/22ms316 KiB
10Runtime error0/22ms316 KiB
11Runtime error0/22ms508 KiB
12Runtime error0/22ms316 KiB
13Time limit exceeded0/2300ms820 KiB
14Time limit exceeded0/2300ms820 KiB
15Time limit exceeded0/2300ms1076 KiB
16Time limit exceeded0/2300ms1368 KiB
17Time limit exceeded0/2286ms1260 KiB
18Time limit exceeded0/2286ms1076 KiB
19Time limit exceeded0/2289ms1076 KiB
20Time limit exceeded0/2287ms836 KiB
21Time limit exceeded0/2282ms1076 KiB
22Runtime error0/224ms1268 KiB