
[ 백준 / 골드4 / 파이썬 Python ] 1647번 - 도시 분활 계획
알고리즘/BAEKJOON (Python)
2023. 4. 10. 16:23
링크 : https://www.acmicpc.net/problem/1647 1647번: 도시 분할 계획 첫째 줄에 집의 개수 N, 길의 개수 M이 주어진다. N은 2이상 100,000이하인 정수이고, M은 1이상 1,000,000이하인 정수이다. 그 다음 줄부터 M줄에 걸쳐 길의 정보가 A B C 세 개의 정수로 주어지는데 A번 www.acmicpc.net 코드 import sys input = sys.stdin.readline def ancestor(node): if parent[node] != node: parent[node] = ancestor(parent[node]) return parent[node] n,m = map(int,input().split()) graph = [list(map(int,..