문제링크: https://school.programmers.co.kr/learn/courses/30/lessons/42627
import heapq
def solution(jobs):
now = 0
i = 0
h = []
cost = 0
start = -1 # 이미 처리한 작업 중복 제거
while i < len(jobs):
for j in jobs:
if start < j[0] <= now:
heapq.heappush(h, (j[1], j[0]))
if h:
start = now
k = heapq.heappop(h)
now += k[0]
i += 1
cost += (now - k[1])
else:
now += 1
return cost // len(jobs)