96922024-02-27 20:58:43birozsLegmesszebbi rossz sorrendű (35 pont)python3Runtime error 0/3518ms13468 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/017ms11244 KiB
2Runtime error0/018ms11564 KiB
3Runtime error0/117ms11916 KiB
4Runtime error0/117ms11900 KiB
5Runtime error0/117ms11812 KiB
6Runtime error0/117ms11744 KiB
7Runtime error0/117ms12120 KiB
8Runtime error0/117ms12016 KiB
9Runtime error0/117ms11940 KiB
10Runtime error0/117ms12064 KiB
11Runtime error0/117ms12256 KiB
12Runtime error0/217ms12144 KiB
13Runtime error0/217ms12208 KiB
14Runtime error0/217ms12212 KiB
15Runtime error0/217ms12556 KiB
16Runtime error0/217ms12236 KiB
17Runtime error0/218ms12456 KiB
18Runtime error0/217ms12740 KiB
19Runtime error0/217ms12668 KiB
20Runtime error0/217ms12712 KiB
21Runtime error0/217ms12776 KiB
22Runtime error0/217ms13016 KiB
23Runtime error0/217ms13176 KiB
24Runtime error0/217ms13468 KiB