96932024-02-27 21:00:32birozsLegmesszebbi rossz sorrendű (35 pont)python3Accepted 35/35115ms37024 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
base35/35
1Accepted0/018ms11344 KiB
2Accepted0/0111ms34836 KiB
3Accepted1/117ms11532 KiB
4Accepted1/117ms11932 KiB
5Accepted1/117ms12200 KiB
6Accepted1/117ms12260 KiB
7Accepted1/117ms12684 KiB
8Accepted1/118ms12780 KiB
9Accepted1/119ms13016 KiB
10Accepted1/120ms13564 KiB
11Accepted1/121ms13708 KiB
12Accepted2/254ms21408 KiB
13Accepted2/261ms23320 KiB
14Accepted2/263ms24028 KiB
15Accepted2/246ms19716 KiB
16Accepted2/264ms24976 KiB
17Accepted2/282ms28276 KiB
18Accepted2/290ms30836 KiB
19Accepted2/2101ms32724 KiB
20Accepted2/2101ms34660 KiB
21Accepted2/2105ms36552 KiB
22Accepted2/2107ms37024 KiB
23Accepted2/2112ms36544 KiB
24Accepted2/2115ms36916 KiB