126762024-12-27 20:54:13mártonágnesFasor (40)cpp17Accepted 40/4045ms520 KiB

#include <iostream>

using namespace std;

int main()
{
    int N, K, db=0, sorsz=1, x, elso;
    bool boldog=false;
    cin >> N >> K;
    cin >> elso;
    for (int i=2; i<=N && !boldog; i++)
    {
        cin >> x;
        if (x>elso)
        {
            db=0;
            elso=x;
            sorsz=i;
            //cout << sorsz << endl;
        }
        else db++;
        //cout << db << endl;
        if (db==K || i==N) boldog=true;
    }
    if (boldog) {cout << sorsz;}
    else cout << -1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms332 KiB
2Accepted0/01ms320 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms508 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms332 KiB
8Accepted2/21ms320 KiB
9Accepted2/21ms320 KiB
10Accepted2/21ms320 KiB
11Accepted2/21ms320 KiB
12Accepted2/21ms320 KiB
13Accepted2/235ms404 KiB
14Accepted2/234ms400 KiB
15Accepted2/239ms396 KiB
16Accepted2/232ms404 KiB
17Accepted2/245ms508 KiB
18Accepted2/234ms520 KiB
19Accepted2/235ms400 KiB
20Accepted2/221ms400 KiB
21Accepted2/245ms320 KiB
22Accepted2/232ms396 KiB