88702024-02-02 17:43:31NagyLeoLegmesszebbi rossz sorrendű (35 pont)python3Time limit exceeded 6/35300ms18376 KiB
def find_misplaced_elements(nums, n):
    max_length = -1
    first_num = 0
    second_num = 0

    for i in range(n-1):
        for j in range(i+1, n):
            if nums[i] > nums[j]:
                if j-i > max_length:
                    max_length = j-i
                    first_num = i
                    second_num = j


    if max_length > -1:
        print(first_num+1, second_num+1)
    else:
        print(-1)

n = int(input())
nums = list(map(int, input().split()))

find_misplaced_elements(nums, n)
SubtaskSumTestVerdictTimeMemory
base6/35
1Accepted0/018ms11228 KiB
2Time limit exceeded0/0300ms16120 KiB
3Accepted1/117ms11540 KiB
4Accepted1/117ms11900 KiB
5Accepted1/117ms11712 KiB
6Accepted1/117ms11952 KiB
7Accepted1/117ms11904 KiB
8Accepted1/174ms12248 KiB
9Time limit exceeded0/1234ms13024 KiB
10Time limit exceeded0/1270ms5408 KiB
11Time limit exceeded0/1259ms5628 KiB
12Time limit exceeded0/2284ms10176 KiB
13Time limit exceeded0/2263ms10752 KiB
14Time limit exceeded0/2252ms11068 KiB
15Time limit exceeded0/2268ms8684 KiB
16Time limit exceeded0/2263ms11368 KiB
17Time limit exceeded0/2275ms13156 KiB
18Time limit exceeded0/2252ms14900 KiB
19Time limit exceeded0/2272ms15456 KiB
20Time limit exceeded0/2280ms16620 KiB
21Time limit exceeded0/2268ms17848 KiB
22Time limit exceeded0/2280ms18376 KiB
23Time limit exceeded0/2261ms18136 KiB
24Time limit exceeded0/2252ms18016 KiB