| Task: | Kolmijako |
| Sender: | feenix |
| Submission time: | 2025-09-06 14:44:17 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| #2 | RUNTIME ERROR | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.06 s | 1, 2, 3 | details |
| #2 | RUNTIME ERROR | 0.06 s | 2, 3 | details |
| #3 | RUNTIME ERROR | 0.06 s | 3 | details |
Code
tests = int(input())
def find_next(inlist, pairs):
if len(pairs) == 0:
return inlist
candidates = list(set(x for x in pairs if x[0] >= inlist[-1][1])) if len(inlist) > 0 else list(set(pairs))
if len(candidates) == 0:
return None
for next in candidates:
newpairs = list(pairs)
newpairs.remove(next)
newlist = inlist + [next]
result = find_next(newlist, newpairs)
if result is not None:
return result
for _ in range(tests):
paircount = int(input())
pairs = []
for _ in range(paircount):
(a, b) = map(int, input().split())
pair = (a, b)
pairs.append(pair)
pairs.sort(key=lambda x: x[1])
result = find_next([], pairs)
if result is not None:
print('YES')
for x in result:
print('{} {}'.format(x[0], x[1]))
else:
print('NO')
Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 15 1 2 3 4 ... |
| correct output |
|---|
| NO NO NO NO YES ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 23, in <module>
(a, b)...Test 2
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1 2 3 4 ... |
| correct output |
|---|
| NO NO NO NO YES ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 23, in <module>
(a, b)...Test 3
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 100 564 895 546 980 ... |
| correct output |
|---|
| YES 188 1 6 12 7 18 13 24 19 30 25 36 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 23, in <module>
(a, b)...