백준 23843번: 콘센트 #Python

ColorlessDia·2025년 2월 7일

algorithm/baekjoon

목록 보기
446/808
import heapq as hq

N, M = map(int, input().split())
t_list = sorted(map(int, input().split()), key=lambda x: -x)

outlet = [0] * M

for t in t_list:
    accumulated_time = hq.heappop(outlet)

    hq.heappush(outlet, accumulated_time + t)

print(max(outlet))

0개의 댓글