Submission #17508793


Source Code Expand

Copy
import heapq

N,K=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(N)]
heapq.heapify(ab)
ans=0
for i in range(K):
    tmp=heapq.heappop(ab)
    ans+=tmp[0]
    heapq.heappush(ab,[tmp[0]+tmp[1],tmp[1]])

print(ans)

Submission Info

Submission Time
Task C - Factory
User kova_plus
Language Python (3.8.2)
Score 300
Code Size 253 Byte
Status AC
Exec Time 610 ms
Memory 28728 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 30 ms 8912 KB
sample_02.txt AC 83 ms 9064 KB
sample_03.txt AC 66 ms 9072 KB
subtask_1_1.txt AC 24 ms 9132 KB
subtask_1_10.txt AC 274 ms 17152 KB
subtask_1_11.txt AC 24 ms 8900 KB
subtask_1_12.txt AC 233 ms 26964 KB
subtask_1_13.txt AC 23 ms 9136 KB
subtask_1_14.txt AC 143 ms 14612 KB
subtask_1_15.txt AC 610 ms 28728 KB
subtask_1_16.txt AC 68 ms 9012 KB
subtask_1_17.txt AC 67 ms 8908 KB
subtask_1_18.txt AC 347 ms 26936 KB
subtask_1_2.txt AC 173 ms 10728 KB
subtask_1_3.txt AC 126 ms 17904 KB
subtask_1_4.txt AC 123 ms 9336 KB
subtask_1_5.txt AC 237 ms 27092 KB
subtask_1_6.txt AC 154 ms 9992 KB
subtask_1_7.txt AC 93 ms 9068 KB
subtask_1_8.txt AC 538 ms 27760 KB
subtask_1_9.txt AC 495 ms 25960 KB