88712024-02-02 17:43:55NagyLeoLegmesszebbi rossz sorrendű (35 pont)pypy3Runtime error 9/35259ms98068 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
base9/35
1Accepted0/050ms87184 KiB
2Runtime error0/078ms98068 KiB
3Accepted1/150ms87432 KiB
4Accepted1/145ms87292 KiB
5Accepted1/145ms87352 KiB
6Accepted1/146ms86988 KiB
7Accepted1/154ms94304 KiB
8Accepted1/171ms94780 KiB
9Accepted1/168ms95600 KiB
10Accepted1/185ms95720 KiB
11Accepted1/189ms95324 KiB
12Time limit exceeded0/2224ms32740 KiB
13Time limit exceeded0/2241ms32744 KiB
14Time limit exceeded0/2229ms32740 KiB
15Time limit exceeded0/2259ms32676 KiB
16Time limit exceeded0/2228ms32672 KiB
17Runtime error0/271ms96884 KiB
18Runtime error0/268ms94940 KiB
19Runtime error0/270ms95200 KiB
20Runtime error0/270ms94848 KiB
21Runtime error0/270ms95220 KiB
22Runtime error0/268ms95160 KiB
23Runtime error0/268ms94992 KiB
24Runtime error0/268ms94748 KiB