백준 1197. 최소 스패닝 트리
·
백준
https://www.acmicpc.net/problem/11971. 프림# 프림 풀이(다익스트라)import heapqimport sysinput = sys.stdin.readlineN, M = map(int,input().split())arr = [[] for _ in range(N+1)]visited = [ 0 for _ in range(N+1)]for _ in range(M): A,B,C = map(int,input().split()) arr[A].append([C,B]) # 가중치를 기준으로 push, pop을 해줘야하니까 순서를 바꾸기 arr[B].append([C,A])ans = 0cnt = 0q = [[0,1]] # 1에서 출발할거다! 가중치 없이!while q: if..