125092024-12-20 22:51:16CsongiFasor (40)cpp17Wrong answer 34/4014ms512 KiB
#include <bits/stdc++.h>
//#define ll long long
using namespace std;

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

    int n,k,x,max=-1,maxi=-2,f=0; cin >> n >> k;
    bool talalt = false;
    for (int i = 0; i < n && !talalt; i++)
    {
        cin >> x;
        if (x > max)
        {
            max = x;
            maxi = i;
            f = 0;
        }
        else
        {
            f++;
        }
        if (f == k)
        {
            talalt = true;
        }
    }

    cout << (talalt ? maxi+1 : -1) << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base34/40
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted2/21ms336 KiB
4Wrong answer0/21ms320 KiB
5Accepted2/21ms388 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/21ms320 KiB
9Accepted2/21ms508 KiB
10Accepted2/21ms320 KiB
11Accepted2/21ms512 KiB
12Accepted2/21ms320 KiB
13Accepted2/210ms432 KiB
14Wrong answer0/210ms424 KiB
15Accepted2/212ms432 KiB
16Accepted2/29ms428 KiB
17Accepted2/213ms500 KiB
18Accepted2/29ms428 KiB
19Accepted2/210ms332 KiB
20Wrong answer0/28ms320 KiB
21Accepted2/214ms428 KiB
22Accepted2/29ms424 KiB