[백준] 16562번 - 친구비 (파이썬)
# 친구비 import sys import heapq input = sys.stdin.readline N, M, k = map(int, input().split()) arr = [[]for _ in range(N+1)] moneys = [0]+list(map(int, input().split())) for i in range(1, N+1): arr[0].append((moneys[i], i)) for _ in range(M): a, b = map(int, input().split()) arr[a].append((0, b)) arr[b].append((0, a)) def make_friend(): global answer q = [] heapq.heappush(q, (0, 0)) visited = [Fal..
2022. 3. 25.