
[Beakjoon] 1922. 네트워크 연결
·
코딩테스트/Python
🔗 Problem Linkhttps://www.acmicpc.net/problem/1922❔Thinking모든 컴퓨터가 연결되어야 할 때, 최소한의 비용을 반환한다.각 컴퓨터를 연결하는 비용이 주어진다.💻Solutionimport sysimport heapqinput = sys.stdin.readlineN = int(input().rstrip())M = int(input().rstrip())lines = []for _ in range(M): a,b,c = map(int, input().split()) heapq.heappush(lines, (c,a,b))def find_parent(x, parent): if x != parent[x]: parent[x] = find_par..