| Task: | Pair sort |
| Sender: | hy2025_003 |
| Submission time: | 2025-09-24 16:48:47 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.06 s | details |
| #2 | RUNTIME ERROR | 0.06 s | details |
| #3 | RUNTIME ERROR | 0.06 s | details |
| #4 | RUNTIME ERROR | 0.06 s | details |
| #5 | RUNTIME ERROR | 0.06 s | details |
| #6 | RUNTIME ERROR | 0.06 s | details |
| #7 | RUNTIME ERROR | 0.06 s | details |
| #8 | RUNTIME ERROR | 0.07 s | details |
| #9 | RUNTIME ERROR | 0.06 s | details |
| #10 | RUNTIME ERROR | 0.06 s | details |
| #11 | RUNTIME ERROR | 0.06 s | details |
| #12 | RUNTIME ERROR | 0.07 s | details |
| #13 | RUNTIME ERROR | 0.06 s | details |
| #14 | RUNTIME ERROR | 0.06 s | details |
Code
def bubble(arr: list[int], max_count: int = 0):
n = len(arr)
swap_count = 0
swaps = []
for i in range(n):
swapped = False
for j in range(0, n-i-1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
swapped = True
swap_count += 1
if (swap_count == max_count):
continue
swaps.append((j, j+1))
if (swapped == False):
break
return swap_count, swaps
n = int(input())
m = list(map(int,input().split()))
count, swaps = bubble(m, n)
# for swap in swaps:
# print(f'{swap[0]} {swap[1]}')
print(count)
print(*m)
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 5 3 2 4 5 1 3 2 1 4 5 |
| correct output |
|---|
| 3 2 6 4 9 6 8 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 3
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 4
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 5
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 6
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 7
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 8
Verdict: RUNTIME ERROR
| 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 |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 500 56 146 351 35 281 235 354 449 ... |
| correct output |
|---|
| 497 2 758 4 820 6 125 8 243 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 1000 603 596 351 885 530 235 354 56... |
| correct output |
|---|
| 993 2 256 4 1534 6 816 8 1057 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...Test 14
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 1594 596 1797 3776 1201 235 35... |
| correct output |
|---|
| 4993 2 1548 4 9062 6 6397 8 8296 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 1, in <module>
def bub...