162612025-04-16 17:57:35algoproFasor (40)cpp17Runtime error 38/4071ms1392 KiB
// UUID: 0c6df169-b5ca-4c57-b9d0-4dcae84a0445
#include <bits/stdc++.h>

typedef unsigned long long int ulli;
typedef long long int lli;

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for(int &h : H) cin >> h;
    int h = 0;
    bool u;
    while(h < N) {
        u = false;
        for(int i = h + 1; i <= h + K; ++i) {
            if(H[h] < H[i]) {
                h = i;
                u = true;
                break;
            }
        }
        if(!u) break;
    }
    cout << h + 1 << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/40
1Accepted0/01ms496 KiB
2Accepted0/04ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms508 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Accepted2/24ms316 KiB
10Accepted2/24ms316 KiB
11Accepted2/24ms316 KiB
12Accepted2/23ms316 KiB
13Accepted2/235ms564 KiB
14Runtime error0/232ms804 KiB
15Accepted2/254ms1392 KiB
16Accepted2/265ms1076 KiB
17Accepted2/271ms1076 KiB
18Accepted2/271ms1076 KiB
19Accepted2/271ms1132 KiB
20Accepted2/220ms564 KiB
21Accepted2/256ms1076 KiB
22Accepted2/271ms1076 KiB