킹솔이
[백준/Python] 1202 보석 도둑 본문
import sys
from queue import PriorityQueue
n, k = map(int, sys.stdin.readline().split())
MV = []
C = []
for i in range(n):
a,b = map(int, sys.stdin.readline().split())
MV.append((a,b))
for i in range(k):
C.append(int(sys.stdin.readline()))
MV.sort()
C.sort()
result = 0
index = 0
que = PriorityQueue()
for i in C:
while index < n and MV[index][0] <= i:
que.put(MV[index][1] * -1)
index += 1
if not que.empty():
result += que.get()
print(-result)
설명은 일단 나중에 ..
'Algorithm' 카테고리의 다른 글
[백준/Python] 13023 ABCDE (0) | 2021.01.13 |
---|---|
[백준/Python] 14867 물통 (0) | 2021.01.13 |
[백준/Python] 2606 바이러스 (0) | 2021.01.08 |
[백준/Python] 2891 카약과 강풍 (1) | 2021.01.06 |
[프로그래머스/C++] 서머코딩/윈터코딩(~2018) 쿠키 구입 (0) | 2020.03.09 |