127612024-12-30 07:59:09birozsInverziópython3Wrong answer 34/50344ms61696 KiB
N = int(input())
lista = list(map(int,input().split()))
#N = 15
#lista = [15,2,3,12,13,11,8,9,10,4,5,7,6,14,1]
maxelter = 0
maxelterpoz = 0
maxertek = 0
for i in range(N):
    if abs(lista[i] - (i+1)) > maxelter:
        maxertek = lista[i]
        maxelter = abs(lista[i] - (i+1))
        maxelterpoz = i+1
if maxelter == 0:
    print(-1)
elif maxertek > maxelterpoz:
    minelterpoz = N
    for i in range(N-1,-1,-1):
        if lista[i] < maxertek:
            minelterpoz = i+1
            break
    print(maxelterpoz,minelterpoz)
else:
    minelterpoz = 1
    for i in range(N):
        if lista[i] > maxertek:
            minelterpoz = i+1
            break
    print(minelterpoz,maxelterpoz)   



SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/016ms3128 KiB
2Accepted0/043ms8800 KiB
3Accepted1/116ms3128 KiB
4Wrong answer0/217ms3136 KiB
5Accepted7/716ms3136 KiB
6Wrong answer0/241ms8972 KiB
7Accepted2/2307ms61672 KiB
8Accepted2/2317ms61636 KiB
9Wrong answer0/2301ms61488 KiB
10Wrong answer0/2296ms61636 KiB
11Wrong answer0/2296ms61636 KiB
12Wrong answer0/2291ms60572 KiB
13Accepted2/2319ms61660 KiB
14Accepted2/2344ms61640 KiB
15Accepted2/2308ms61696 KiB
16Accepted2/2298ms61656 KiB
17Wrong answer0/2305ms61636 KiB
18Accepted2/2330ms61636 KiB
19Accepted3/3296ms61624 KiB
20Accepted3/3307ms61632 KiB
21Accepted2/2326ms61488 KiB
22Accepted2/2324ms61584 KiB
23Wrong answer0/2305ms61640 KiB
24Accepted2/2279ms61540 KiB