183282025-10-20 15:27:07algoproInverziópypy3Accepted 50/501.763s95600 KiB
# UUID: 267e99a4-ea8a-485f-874b-21653ff5bb39
N = int(input())
A = sorted([(int(x),i) for i,x  in enumerate(input().split())])

a=b=0
leghatso=0
for i in range(N):
    cur,index=A[i]
    if index < leghatso:
        if leghatso-index>b-a:
            b=leghatso
            a=index
    leghatso=max(leghatso,index)

if a==b:
    print(-1)
else:
    print(a+1,b+1) 
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/043ms19508 KiB
2Accepted0/0108ms28580 KiB
3Accepted1/139ms19468 KiB
4Accepted2/250ms21264 KiB
5Accepted7/748ms21228 KiB
6Accepted2/2165ms28648 KiB
7Accepted2/2564ms95468 KiB
8Accepted2/21.731s95456 KiB
9Accepted2/21.763s95600 KiB
10Accepted2/21.636s95476 KiB
11Accepted2/21.534s95348 KiB
12Accepted2/21.636s94776 KiB
13Accepted2/21.552s95524 KiB
14Accepted2/21.608s95424 KiB
15Accepted2/2558ms95472 KiB
16Accepted2/21.585s95476 KiB
17Accepted2/21.623s95476 KiB
18Accepted2/21.613s95388 KiB
19Accepted3/3564ms95476 KiB
20Accepted3/3561ms95472 KiB
21Accepted2/2564ms95476 KiB
22Accepted2/21.493s95472 KiB
23Accepted2/21.552s95384 KiB
24Accepted2/2277ms95368 KiB