97332024-03-04 15:52:25ct72Fasor (40)cpp17Runtime error 38/4075ms10164 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0;i<n;i++) {
        cin >> v[i];
    }
    int i=0,s=-1;
    while(i!=s) {
        s=i;
        for (int j = i + 1; j <= i + k; j++) {
            if (v[j] > v[i]) {
                s = j;
                break;
            }

        }
        if(s!=i)
        {
            i=s;
            s=-1;
        }
    }
    cout << i+1;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/40
1Accepted0/03ms1812 KiB
2Accepted0/04ms2104 KiB
3Accepted2/23ms2200 KiB
4Accepted2/23ms2328 KiB
5Accepted2/23ms2420 KiB
6Accepted2/23ms2416 KiB
7Accepted2/23ms2668 KiB
8Accepted2/23ms2784 KiB
9Accepted2/26ms3176 KiB
10Accepted2/26ms3256 KiB
11Accepted2/26ms3576 KiB
12Accepted2/24ms3856 KiB
13Accepted2/239ms5084 KiB
14Runtime error0/237ms5680 KiB
15Accepted2/259ms6688 KiB
16Accepted2/268ms7024 KiB
17Accepted2/275ms7612 KiB
18Accepted2/275ms8436 KiB
19Accepted2/275ms9192 KiB
20Accepted2/223ms8488 KiB
21Accepted2/261ms9388 KiB
22Accepted2/274ms10164 KiB