96912024-02-27 20:57:11birozsLegmesszebbi rossz sorrendű (35 pont)python3Runtime error 0/3518ms13672 KiB
be = open("in.1")
n = int(be.readline())
lista = list(map(int,be.readline().split()))

#n = int(input())
#lista = list(map(int,input().split()))
min = []
aktmin = lista[-1]
for i in range(n-1,-1,-1):
    if lista[i] < aktmin:
        aktmin = lista[i]
    min.append(aktmin)
min.reverse()
if lista == min:
    print(-1)
else:
    tav = 0
    for i in range(n-1):
        if i+tav < n and lista[i] > min[i+tav]:
            j = i+tav
            while j < n and min[j] < lista[i]:
                j += 1
            if j-i-1 > tav:
                tav = j - i - 1
                elso = i+1
                utolso = j
    print(elso,utolso)











SubtaskSumTestVerdictTimeMemory
base0/35
1Runtime error0/018ms11056 KiB
2Runtime error0/017ms11568 KiB
3Runtime error0/118ms11564 KiB
4Runtime error0/117ms11512 KiB
5Runtime error0/118ms11976 KiB
6Runtime error0/117ms11972 KiB
7Runtime error0/117ms11964 KiB
8Runtime error0/117ms11800 KiB
9Runtime error0/117ms12036 KiB
10Runtime error0/117ms12068 KiB
11Runtime error0/117ms12440 KiB
12Runtime error0/217ms12536 KiB
13Runtime error0/217ms12368 KiB
14Runtime error0/218ms12900 KiB
15Runtime error0/217ms13032 KiB
16Runtime error0/217ms12820 KiB
17Runtime error0/217ms13304 KiB
18Runtime error0/217ms13300 KiB
19Runtime error0/217ms13316 KiB
20Runtime error0/217ms13476 KiB
21Runtime error0/217ms13076 KiB
22Runtime error0/217ms13472 KiB
23Runtime error0/217ms13496 KiB
24Runtime error0/217ms13672 KiB