88922024-02-02 22:38:00radocziaronLegmesszebbi rossz sorrendű (35 pont)python3Time limit exceeded 6/35280ms19068 KiB
n = int(input())
lista = list(map(int,input().split()))
i = 0
o = -1
x = 0
y = 0

if lista == sorted(lista):
    print(-1)
else:
    while n-i > o:
        for j in range(n-1,i,-1):
            if lista[j] < lista[i]:
                if j-i > o:
                    o = j-i
                    x = i
                    y = j
                break
        i += 1
    print(x+1,"",y+1)
SubtaskSumTestVerdictTimeMemory
base6/35
1Accepted0/018ms10964 KiB
2Time limit exceeded0/0264ms16252 KiB
3Accepted1/117ms11748 KiB
4Accepted1/117ms12016 KiB
5Accepted1/117ms12192 KiB
6Accepted1/117ms12460 KiB
7Accepted1/117ms12172 KiB
8Accepted1/1104ms12732 KiB
9Time limit exceeded0/1252ms5496 KiB
10Time limit exceeded0/1266ms5704 KiB
11Time limit exceeded0/1263ms6004 KiB
12Time limit exceeded0/2272ms10428 KiB
13Time limit exceeded0/2272ms11164 KiB
14Time limit exceeded0/2280ms11520 KiB
15Time limit exceeded0/2268ms9276 KiB
16Time limit exceeded0/2263ms12272 KiB
17Time limit exceeded0/2272ms14240 KiB
18Time limit exceeded0/2263ms15884 KiB
19Time limit exceeded0/2272ms16188 KiB
20Time limit exceeded0/2268ms17136 KiB
21Time limit exceeded0/2272ms18200 KiB
22Time limit exceeded0/2280ms19068 KiB
23Time limit exceeded0/2268ms18248 KiB
24Time limit exceeded0/2256ms18268 KiB