제출 #1083628

#제출 시각아이디문제언어결과실행 시간메모리
1083628LouisCheng어르신 집배원 (BOI14_postmen)Cpython 3
0 / 100
12 ms2908 KiB
import sys # sys.stdin = open("1.in", "r") n, m = map(int, input().split()) paths = [set() for _ in range(n)] for _ in range(m): a, b = map(lambda x: int(x) - 1, input().split()) paths[a].add(b) paths[b].add(a) res = [] def solve(node): while paths[node]: top = paths[node].pop() paths[top].remove(node) solve(top) res.append(node + 1) solve(0) print(*res)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...