📖 문제 📃 코드 import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline N, M = map(int, input().split()) matrix = [[0]*(N+1) for i in range(N+1)] visited = [False] * (N+1) for i in range(M): a, b = map(int, input().split()) matrix[a][b] = matrix[b][a] = 1 def dfs(v): visited[v] = True for node in range(len(matrix[v])): if visited[node] == False and matrix[v][node] == 1: dfs(node) cnt = 0 fo..