183312025-10-20 15:33:10algoproInverziópypy3Accepted 50/501.71s91444 KiB
# UUID: 5fc52346-b823-479c-9b5e-77fed733dafb
import sys
input = sys.stdin.readline

def solv():
    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) 

solv()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/039ms19416 KiB
2Accepted0/0104ms28244 KiB
3Accepted1/143ms19416 KiB
4Accepted2/245ms21392 KiB
5Accepted7/743ms21220 KiB
6Accepted2/2174ms28192 KiB
7Accepted2/2560ms84044 KiB
8Accepted2/21.71s84132 KiB
9Accepted2/21.7s84088 KiB
10Accepted2/21.611s84084 KiB
11Accepted2/21.539s84084 KiB
12Accepted2/21.611s91444 KiB
13Accepted2/21.572s84056 KiB
14Accepted2/21.531s84088 KiB
15Accepted2/2561ms84084 KiB
16Accepted2/21.562s84084 KiB
17Accepted2/21.618s84088 KiB
18Accepted2/21.608s84084 KiB
19Accepted3/3560ms84088 KiB
20Accepted3/3560ms84080 KiB
21Accepted2/2563ms84084 KiB
22Accepted2/21.577s84084 KiB
23Accepted2/21.6s84088 KiB
24Accepted2/2238ms84192 KiB