[프로그래머스] 배달 (Python)
💁🏻 나의 풀이 import heapq def solution(N, road, K): answer = 0 graph = {node: {} for node in range(1, N+1)} distances = {node: int(2000 * 1e4) for node in range(1, N+1)} distances[1] = 0 queue = [] heapq.heappush(queue, [distances[1], 1]) for path in road: a, b, c = path if b in graph[a] and c >= graph[a][b]: continue graph[a][b] = c graph[b][a] = c while queue: distance_now, destination_now = heapq..
2022.05.13