Submission #35122683
Source Code Expand
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(2000000)
def main():
def solve(p=[]):
nonlocal flag
if flag:
return
node = p[-1]
if node == Y:
print(" ".join([str(no) for no in p]))
flag = True
sys.exit()
return
for n in path[node]:
if n not in visited:
visited.add(n)
solve(p + [n])
return
N, X, Y = map(int, input().split())
flag = False
visited = {X}
path = [set() for _ in range(N + 1)]
for i in range(N - 1):
u, v = map(int, input().split())
path[u].add(v)
path[v].add(u)
solve(p=[X])
if __name__ == "__main__":
main()
Submission Info
| Submission Time | |
|---|---|
| Task | C - Simple path |
| User | rainline |
| Language | PyPy3 (7.3.0) |
| Score | 0 |
| Code Size | 748 Byte |
| Status | TLE |
| Exec Time | 2257 ms |
| Memory | 1753312 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 300 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 70 ms | 61484 KiB |
| example_01.txt | AC | 53 ms | 61284 KiB |
| hand_00.txt | AC | 50 ms | 61464 KiB |
| hand_01.txt | TLE | 2257 ms | 1753308 KiB |
| hand_02.txt | AC | 493 ms | 162876 KiB |
| hand_03.txt | TLE | 2257 ms | 1736968 KiB |
| hand_04.txt | TLE | 2257 ms | 1753312 KiB |
| random_00.txt | AC | 672 ms | 147864 KiB |
| random_01.txt | AC | 613 ms | 140916 KiB |
| random_02.txt | AC | 630 ms | 144488 KiB |
| random_03.txt | AC | 666 ms | 151404 KiB |
| random_04.txt | AC | 683 ms | 155660 KiB |
| random_05.txt | AC | 600 ms | 135928 KiB |
| random_06.txt | AC | 534 ms | 127148 KiB |
| random_07.txt | AC | 654 ms | 142812 KiB |
| random_08.txt | AC | 615 ms | 139648 KiB |
| random_09.txt | AC | 498 ms | 159896 KiB |
| random_10.txt | AC | 505 ms | 162040 KiB |
| random_11.txt | AC | 524 ms | 157836 KiB |
| random_12.txt | TLE | 2252 ms | 1541568 KiB |
| random_13.txt | TLE | 2246 ms | 1300208 KiB |
| random_14.txt | TLE | 2247 ms | 1316744 KiB |
| random_15.txt | TLE | 2246 ms | 1283228 KiB |
| random_16.txt | TLE | 2245 ms | 1269580 KiB |
| random_17.txt | TLE | 2243 ms | 1155544 KiB |
| random_18.txt | TLE | 2253 ms | 1548764 KiB |
| random_19.txt | TLE | 2245 ms | 1224464 KiB |