51021 [SWEA 5102번] 노드의 거리 from collections import deque t = int(input()) answer = [] for _ in range(t): v, e = map(int,input().split()) graph = [[] for _ in range(v+1)] visited = [0]*(v+1) for i in range(e): start, end = map(int,input().split()) graph[start].append(end) graph[end].append(start) s, g = map(int,input().split()) def bfs(s,g): visited[s] = 0 queue = deque([s]) while queue: v = queue.popleft() for node in gra.. 2023. 9. 21. 이전 1 다음