Submission #18230153


Source Code Expand

Copy
import heapq

N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]

heapq.heapify(ab)
    
time = 0
for _ in range(K):
    a, b = heapq.heappop(ab)
    time += a
    heapq.heappush(ab, [a+b, b])
    
print(time)

Submission Info

Submission Time
Task C - Factory
User Hakubi
Language Python (3.8.2)
Score 300
Code Size 261 Byte
Status AC
Exec Time 530 ms
Memory 28784 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 31 ms 9152 KB
sample_02.txt AC 83 ms 9152 KB
sample_03.txt AC 63 ms 8924 KB
subtask_1_1.txt AC 28 ms 9212 KB
subtask_1_10.txt AC 273 ms 17344 KB
subtask_1_11.txt AC 20 ms 9216 KB
subtask_1_12.txt AC 227 ms 27284 KB
subtask_1_13.txt AC 28 ms 9024 KB
subtask_1_14.txt AC 128 ms 14624 KB
subtask_1_15.txt AC 530 ms 28784 KB
subtask_1_16.txt AC 67 ms 9156 KB
subtask_1_17.txt AC 69 ms 9032 KB
subtask_1_18.txt AC 336 ms 27132 KB
subtask_1_2.txt AC 167 ms 10732 KB
subtask_1_3.txt AC 125 ms 17908 KB
subtask_1_4.txt AC 124 ms 9208 KB
subtask_1_5.txt AC 233 ms 26920 KB
subtask_1_6.txt AC 151 ms 9816 KB
subtask_1_7.txt AC 88 ms 9088 KB
subtask_1_8.txt AC 490 ms 27768 KB
subtask_1_9.txt AC 441 ms 25652 KB