| Task: | Longest route |
| Sender: | aalto25h_001 |
| Submission time: | 2025-10-22 16:51:45 +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.07 s | details |
| #4 | RUNTIME ERROR | 0.06 s | details |
| #5 | RUNTIME ERROR | 0.06 s | details |
| #6 | RUNTIME ERROR | 0.07 s | details |
| #7 | RUNTIME ERROR | 0.07 s | details |
| #8 | RUNTIME ERROR | 0.07 s | details |
| #9 | RUNTIME ERROR | 0.07 s | details |
| #10 | RUNTIME ERROR | 0.06 s | details |
| #11 | RUNTIME ERROR | 0.07 s | details |
| #12 | RUNTIME ERROR | 0.06 s | details |
| #13 | RUNTIME ERROR | 0.06 s | details |
| #14 | RUNTIME ERROR | 0.06 s | details |
| #15 | RUNTIME ERROR | 0.06 s | details |
| #16 | RUNTIME ERROR | 0.07 s | details |
| #17 | RUNTIME ERROR | 0.06 s | details |
| #18 | RUNTIME ERROR | 0.07 s | details |
| #19 | RUNTIME ERROR | 0.06 s | details |
| #20 | RUNTIME ERROR | 0.06 s | details |
| #21 | RUNTIME ERROR | 0.06 s | details |
Code
import sys
sys.setrecursionlimit(10**10)
n, m = [int(x) for x in input().split()]
matrice = {i:set() for i in range(1, n+1)}
for _ in range(m):
a, b = [int(x) for x in input().split()]
matrice[a].add(b)
def dfs(node, tab=[]):
new_tab = tab.copy()
new_tab.append(node)
if node == n:
return new_tab
local_tab = []
for next_node in matrice[node]:
res_tab = dfs(next_node, new_tab)
if len(res_tab) > len(local_tab):
local_tab = res_tab
return local_tab
res = dfs(1)
if res == [] or res[-1] != n:
print("IMPOSSIBLE")
else:
print(len(res))
for elt in res:
print(elt, end=' ')
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 2 6 1 2 4 6 5 6 ... |
| correct output |
|---|
| 5 1 2 5 6 10 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 2
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 3 9 6 5 6 9 2 8 ... |
| correct output |
|---|
| 4 1 2 8 10 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 5 10 4 10 8 7 7 10 ... |
| correct output |
|---|
| 3 1 4 10 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 4
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 8 10 2 6 2 10 7 10 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 5
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 8 4 2 10 1 3 4 9 ... |
| correct output |
|---|
| 5 1 8 7 2 10 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 6
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 86085 57043 45527 29537 41919 84699 95993 82082 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 7
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 10961 53490 59843 36636 40674 66772 32618 41570 ... |
| correct output |
|---|
| 31 1 37239 44082 21537 90572 7332... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 8
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 87375 76468 38855 27547 49415 83191 38572 1524 ... |
| correct output |
|---|
| 35 1 91343 59014 56722 34054 3875... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 9
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 17973 70097 19982 80323 96486 2404 75650 63274 ... |
| correct output |
|---|
| 36 1 25685 90292 59380 91058 2663... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 10
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 74343 53088 97443 7885 64807 58252 9374 33312 ... |
| correct output |
|---|
| 28 1 26390 15278 11333 48479 6881... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 11
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 199998 1 100000 1 100000 2 100000 2 100000 ... |
| correct output |
|---|
| 2 1 100000 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 12
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 199998 1 2 1 2 2 3 2 3 ... |
| correct output |
|---|
| 100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 13
Verdict: RUNTIME ERROR
| input |
|---|
| 2 1 1 2 |
| correct output |
|---|
| 2 1 2 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 14
Verdict: RUNTIME ERROR
| input |
|---|
| 5 4 1 2 2 3 3 4 1 5 |
| correct output |
|---|
| 2 1 5 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 15
Verdict: RUNTIME ERROR
| input |
|---|
| 99999 149997 1 3 3 5 5 7 7 9 ... |
| correct output |
|---|
| 99999 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 16
Verdict: RUNTIME ERROR
| input |
|---|
| 3 2 1 3 3 2 |
| correct output |
|---|
| 2 1 3 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 17
Verdict: RUNTIME ERROR
| input |
|---|
| 99999 149997 1 2 2 4 4 6 6 8 ... |
| correct output |
|---|
| 99999 1 3 2 5 4 7 6 9 8 11 10 13 12 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 18
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 200000 1 2 1 3 1 4 1 5 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 19
Verdict: RUNTIME ERROR
| input |
|---|
| 5 4 2 1 3 1 1 4 1 5 |
| correct output |
|---|
| 2 1 5 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 20
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 99999 99999 100000 99998 99999 99997 99998 99996 99997 ... |
| correct output |
|---|
| 100000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integerTest 21
Verdict: RUNTIME ERROR
| input |
|---|
| 4 4 3 1 3 4 1 2 2 4 |
| correct output |
|---|
| 3 1 2 4 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 2, in <module>
sys.setrecursionlimit(10**10)
OverflowError: expected a 32-bit integer