| Task: | Pair sort |
| Sender: | aalto25d_001 |
| Submission time: | 2025-09-24 16:32:22 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.04 s | details |
| #2 | WRONG ANSWER | 0.04 s | details |
| #3 | WRONG ANSWER | 0.05 s | details |
| #4 | WRONG ANSWER | 0.04 s | details |
| #5 | WRONG ANSWER | 0.04 s | details |
| #6 | WRONG ANSWER | 0.04 s | details |
| #7 | WRONG ANSWER | 0.05 s | details |
| #8 | WRONG ANSWER | 0.05 s | details |
| #9 | WRONG ANSWER | 0.07 s | details |
| #10 | WRONG ANSWER | 0.07 s | details |
| #11 | WRONG ANSWER | 0.08 s | details |
| #12 | WRONG ANSWER | 0.08 s | details |
| #13 | WRONG ANSWER | 0.15 s | details |
| #14 | WRONG ANSWER | 0.14 s | details |
Code
def main():
n = int(input())
arr = list(map(int, input().split()))
count = 0
result = []
for i in range(n):
firstPos = 2 * i
secondPos = 2 * i + 1
prev_num = arr[firstPos]
curr_num = arr[secondPos]
print(firstPos, secondPos, prev_num, curr_num)
if prev_num == curr_num:
continue
for j in range(secondPos + 1, 2 * n):
if arr[j] == curr_num:
count += 1
result.append([firstPos + 1, j + 1])
arr[firstPos], arr[j] = arr[j], arr[firstPos]
print(count)
for pair in result:
print(" ".join(map(str, pair)))
if __name__ == "__main__":
main()
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| 0 1 3 2 2 3 4 5 4 5 1 3 6 7 1 1 8 9 4 4 ... |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| 0 1 3 2 2 3 4 5 4 5 1 3 6 7 1 1 8 9 4 4 ... |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 6 6 8 8 9 9 1 4 5 2 4 10 2 1... |
| correct output |
|---|
| 9 2 17 4 17 6 17 8 17 ... |
| user output |
|---|
| 0 1 3 6 2 3 3 8 4 5 3 9 6 7 3 1 8 9 4 5 ... Truncated |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 6 6 8 8 9 9 1 4 5 2 4 10 2 1... |
| correct output |
|---|
| 9 2 17 4 17 6 17 8 17 ... |
| user output |
|---|
| 0 1 3 6 2 3 3 8 4 5 3 9 6 7 3 1 8 9 4 5 ... Truncated |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 50 47 26 6 35 13 18 9 19 14 50 34... |
| correct output |
|---|
| 48 2 87 4 78 6 71 8 55 ... |
| user output |
|---|
| 0 1 47 26 2 3 6 35 4 5 13 18 6 7 9 19 8 9 14 50 ... Truncated |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 50 47 26 6 35 13 18 9 19 14 50 34... |
| correct output |
|---|
| 48 2 87 4 78 6 71 8 55 ... |
| user output |
|---|
| 0 1 47 26 2 3 6 35 4 5 13 18 6 7 9 19 8 9 14 50 ... Truncated |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 100 56 26 6 35 60 72 9 55 83 51 58... |
| correct output |
|---|
| 97 2 77 4 108 6 141 8 55 ... |
| user output |
|---|
| 0 1 56 26 2 3 6 35 4 5 60 72 6 7 9 55 8 9 83 51 ... Truncated |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100 56 26 6 35 60 72 9 55 83 51 58... |
| correct output |
|---|
| 97 2 77 4 108 6 141 8 55 ... |
| user output |
|---|
| 0 1 56 26 2 3 6 35 4 5 60 72 6 7 9 55 8 9 83 51 ... Truncated |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| 0 1 56 146 2 3 351 35 4 5 281 235 6 7 354 449 8 9 83 464 ... Truncated |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| 0 1 56 146 2 3 351 35 4 5 281 235 6 7 354 449 8 9 83 464 ... Truncated |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| 0 1 603 596 2 3 351 885 4 5 530 235 6 7 354 566 8 9 83 598 ... Truncated |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| 0 1 603 596 2 3 351 885 4 5 530 235 6 7 354 566 8 9 83 598 ... Truncated |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| 0 1 1594 596 2 3 1797 3776 4 5 1201 235 6 7 354 1878 8 9 83 3959 ... Truncated |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| 0 1 1594 596 2 3 1797 3776 4 5 1201 235 6 7 354 1878 8 9 83 3959 ... Truncated |
