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
Exec Time 610 ms
Memory 28728 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
× 3
× 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 30 ms 8912 KB
sample_02.txt 83 ms 9064 KB
sample_03.txt 66 ms 9072 KB
subtask_1_1.txt 24 ms 9132 KB
subtask_1_10.txt 274 ms 17152 KB
subtask_1_11.txt 24 ms 8900 KB
subtask_1_12.txt 233 ms 26964 KB
subtask_1_13.txt 23 ms 9136 KB
subtask_1_14.txt 143 ms 14612 KB
subtask_1_15.txt 610 ms 28728 KB
subtask_1_16.txt 68 ms 9012 KB
subtask_1_17.txt 67 ms 8908 KB
subtask_1_18.txt 347 ms 26936 KB
subtask_1_2.txt 173 ms 10728 KB
subtask_1_3.txt 126 ms 17904 KB
subtask_1_4.txt 123 ms 9336 KB
subtask_1_5.txt 237 ms 27092 KB
subtask_1_6.txt 154 ms 9992 KB
subtask_1_7.txt 93 ms 9068 KB
subtask_1_8.txt 538 ms 27760 KB
subtask_1_9.txt 495 ms 25960 KB