백준 1260 DFS와 BFS
·
CodingTest
문제 https://www.acmicpc.net/problem/1260 코드(전체) N, M, start = map(int,input().split()) graph = [ [] * i for i in range(N+1) ] for i in range(M) : v1, v2 = map(int, input().split()) graph[v1].append(v2) graph[v2].append(v1) graph = [sorted(x) for x in graph] #print(graph) #DFS def dfs(graph,v, visited) : visited[v] = True print(v, end=' ') for i in graph[v] : if not visited[i] : dfs(graph,i,visite..