1251
![[python] SWEA - 1251. 하나로 / 1486. 장훈이의 높은 선반](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FAlohj%2FbtqEENPBHmp%2F8Uum2CwYxDkLNQy2wxXMt0%2Fimg.png)
[python] SWEA - 1251. 하나로 / 1486. 장훈이의 높은 선반
1. 하나로 문제 해결 1. 프림 + 힙큐 2. 인접리스트를 만들어 준다. 3. 힙큐를 이용해 가중치가 가장 낮은 점을 선택하고 4. key 리스트를 최솟값으로 갱신해가며 결과를 더해준다. 🔨 인접 행렬로 하다가 몇시간 날린 것 같다. 역시 난 인접리스트를 쓰는게 편하다. 소스 코드 import heapq for tc in range(1, 1+int(input())): n = int(input()) x_location = list(map(int, input().split())) y_location = list(map(int, input().split())) tax = float(input()) # 인접 리스트 adj = {i: [] for i in range(n)} for s in range(n): fo..