183322025-10-20 15:34:37algoproInverziópypy3Accepted 50/501.695s77844 KiB
# UUID: 25417638-0c85-4fff-a88d-947614efb409
import sys
input = sys.stdin.readline

def solv():
    N = int(input())
    #A = sorted([(int(x),i) for i,x  in enumerate(input().split())])
    B=list(map(int,input().split()))
    A=[(B[i],i) for i in range(N)]
    A.sort()
    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/039ms19552 KiB
2Accepted0/097ms28396 KiB
3Accepted1/143ms19436 KiB
4Accepted2/248ms21176 KiB
5Accepted7/750ms21228 KiB
6Accepted2/2175ms28312 KiB
7Accepted2/2546ms77824 KiB
8Accepted2/21.695s77812 KiB
9Accepted2/21.68s77804 KiB
10Accepted2/21.59s77824 KiB
11Accepted2/21.493s77812 KiB
12Accepted2/21.611s76856 KiB
13Accepted2/21.534s77812 KiB
14Accepted2/21.603s77812 KiB
15Accepted2/2542ms77812 KiB
16Accepted2/21.552s77812 KiB
17Accepted2/21.588s77812 KiB
18Accepted2/21.495s77812 KiB
19Accepted3/3573ms77824 KiB
20Accepted3/3574ms77752 KiB
21Accepted2/2546ms77796 KiB
22Accepted2/21.467s77812 KiB
23Accepted2/21.519s77812 KiB
24Accepted2/2225ms77844 KiB