127872024-12-30 17:42:21birozsInverziópython3Time limit exceeded 12/50601ms61640 KiB
N = int(input())
lista = list(map(int,input().split()))
#N = 15
#lista = [4,2,3,1,5,6,7,8,11,12,9,13,10,14,15]
#lista = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
#elter = [3,0,0,3,0,0,0,0,2,2,2,1,3,0,0]
maxhossz = 0
for i in range(N-1):
    if lista[i] > i+1:
        j = N - 1
        while i < j and lista[i] < lista[j] and j - i > maxhossz:
            j -= 1
        if j - i > maxhossz:
            maxhossz = j - i
            maxkezdo = i + 1
            maxveg = j + 1
    if i + maxhossz > N:
        break
if maxhossz == 0:
    print(-1)
else:
    print(maxkezdo,maxveg)





SubtaskSumTestVerdictTimeMemory
base12/50
1Accepted0/016ms2996 KiB
2Time limit exceeded0/0583ms8800 KiB
3Accepted1/116ms3116 KiB
4Accepted2/216ms3128 KiB
5Accepted7/735ms3312 KiB
6Time limit exceeded0/2578ms8792 KiB
7Time limit exceeded0/2578ms61636 KiB
8Time limit exceeded0/2583ms61632 KiB
9Time limit exceeded0/2587ms61636 KiB
10Time limit exceeded0/2587ms61640 KiB
11Time limit exceeded0/2587ms61636 KiB
12Time limit exceeded0/2588ms60548 KiB
13Time limit exceeded0/2586ms61628 KiB
14Time limit exceeded0/2601ms61632 KiB
15Time limit exceeded0/2601ms61616 KiB
16Time limit exceeded0/2586ms61636 KiB
17Time limit exceeded0/2578ms61636 KiB
18Time limit exceeded0/2601ms61628 KiB
19Time limit exceeded0/3601ms61556 KiB
20Time limit exceeded0/3584ms61628 KiB
21Time limit exceeded0/2586ms61636 KiB
22Time limit exceeded0/2584ms61640 KiB
23Time limit exceeded0/2601ms61632 KiB
24Accepted2/2291ms61636 KiB