99432024-03-20 22:36:5542Legcsalódottabb versenyző (75 pont)python3Accepted 75/7568ms35624 KiB
# O(N)

from sys import stdin
input=stdin.readline

def solv():
    N = int(input())
    P = [int(x) for x in input().split()]
    maxl=1
    resindex=0
    curl=1
    curindex=0
    for i in range(1,N):
        if P[i] > P[curindex]:
            if maxl<curl:
                resindex=curindex
                maxl=curl
            curindex=i
            curl=1
        else:
            curl+=1
    if curl==N:
        print(-1)
    else:
        print(resindex+1)
    
solv()
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms11112 KiB
2Accepted0/065ms34332 KiB
3Accepted5/517ms11696 KiB
4Accepted5/517ms11452 KiB
5Accepted5/517ms11792 KiB
6Accepted5/517ms11560 KiB
7Accepted5/517ms11940 KiB
8Accepted5/517ms12376 KiB
9Accepted5/517ms12164 KiB
10Accepted5/517ms12236 KiB
11Accepted5/517ms12060 KiB
12Accepted5/517ms12576 KiB
13Accepted5/565ms35624 KiB
14Accepted5/565ms35520 KiB
15Accepted5/568ms35624 KiB
16Accepted5/567ms35548 KiB
17Accepted5/567ms35540 KiB