99412024-03-20 22:33:3842Legcsalódottabb versenyző (75 pont)python3Wrong answer 70/7568ms36040 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 maxl==N:
        print(-1)
    else:
        print(resindex+1)
    
solv()
SubtaskSumTestVerdictTimeMemory
base70/75
1Accepted0/017ms11312 KiB
2Accepted0/067ms34460 KiB
3Wrong answer0/517ms12012 KiB
4Accepted5/517ms11800 KiB
5Accepted5/517ms11840 KiB
6Accepted5/517ms12200 KiB
7Accepted5/517ms12436 KiB
8Accepted5/517ms12356 KiB
9Accepted5/518ms12756 KiB
10Accepted5/518ms12560 KiB
11Accepted5/518ms12796 KiB
12Accepted5/517ms13060 KiB
13Accepted5/568ms35792 KiB
14Accepted5/565ms35700 KiB
15Accepted5/565ms36040 KiB
16Accepted5/565ms35856 KiB
17Accepted5/567ms35984 KiB