125082024-12-20 22:49:43CsongiFasor (40)cpp17Wrong answer 22/4010ms508 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;
        }
        else
        {
            f++;
        }
        if (f == k)
        {
            talalt = true;
        }
    }

    cout << (talalt ? maxi+1 : -1) << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/01ms320 KiB
2Wrong answer0/01ms320 KiB
3Accepted2/21ms332 KiB
4Wrong answer0/21ms508 KiB
5Accepted2/21ms320 KiB
6Wrong answer0/21ms320 KiB
7Accepted2/21ms320 KiB
8Wrong answer0/21ms320 KiB
9Accepted2/21ms320 KiB
10Wrong answer0/21ms320 KiB
11Wrong answer0/21ms320 KiB
12Accepted2/21ms320 KiB
13Wrong answer0/24ms320 KiB
14Wrong answer0/210ms320 KiB
15Accepted2/28ms428 KiB
16Accepted2/27ms428 KiB
17Accepted2/210ms428 KiB
18Wrong answer0/24ms320 KiB
19Wrong answer0/22ms428 KiB
20Accepted2/24ms424 KiB
21Accepted2/28ms428 KiB
22Accepted2/26ms436 KiB