126752024-12-27 20:51:28mártonágnesFasor (40)cpp17Wrong answer 36/4046ms508 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 || sorsz==N) boldog=true;
    }
    if (boldog) {cout << sorsz;}
    else cout << -1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/40
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/21ms320 KiB
9Accepted2/22ms500 KiB
10Accepted2/22ms320 KiB
11Accepted2/21ms320 KiB
12Accepted2/21ms500 KiB
13Accepted2/235ms400 KiB
14Wrong answer0/234ms396 KiB
15Accepted2/239ms408 KiB
16Accepted2/232ms404 KiB
17Accepted2/243ms500 KiB
18Accepted2/234ms400 KiB
19Accepted2/234ms408 KiB
20Wrong answer0/220ms320 KiB
21Accepted2/246ms404 KiB
22Accepted2/232ms508 KiB