80692024-01-12 11:56:18GhostFasor (40)cpp17Accepted 40/4046ms4328 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, viewdis, i;
    cin >> n >> viewdis;

    int pos = -1, seen = 0, chight = 0, hight;
    for (i = 0; i < n; i++) {
        if (seen == viewdis) {
            cout << pos;
            return 0;
        }
        cin >> hight;
        if (chight < hight) {
            pos = i + 1;
            seen = 0;
            chight = hight;
        }
        else { seen++; }
    }
    cout << pos;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Accepted2/23ms2328 KiB
4Accepted2/23ms2492 KiB
5Accepted2/23ms2728 KiB
6Accepted2/23ms2904 KiB
7Accepted2/23ms3016 KiB
8Accepted2/23ms3196 KiB
9Accepted2/23ms3240 KiB
10Accepted2/23ms3440 KiB
11Accepted2/23ms3660 KiB
12Accepted2/23ms3728 KiB
13Accepted2/237ms3828 KiB
14Accepted2/235ms4076 KiB
15Accepted2/239ms4328 KiB
16Accepted2/235ms4044 KiB
17Accepted2/246ms4096 KiB
18Accepted2/235ms4124 KiB
19Accepted2/239ms4104 KiB
20Accepted2/223ms4096 KiB
21Accepted2/246ms4096 KiB
22Accepted2/234ms4096 KiB