Submission #18237809


Source Code Expand

Copy
from heapq import heappop, heappush,heapify

N,K = map(int,input().split())
table = []
count = 0
t = 0
for i in range(N):
    a,b = map(int,input().split())
    heappush(table,(a,b))

while count<K:
    a,b = heappop(table)
    t += a
    a += b
    count += 1
    heappush(table,(a,b))

print(t)

Submission Info

Submission Time
Task C - Factory
User kumpy
Language Python (3.8.2)
Score 300
Code Size 313 Byte
Status AC
Exec Time 413 ms
Memory 22624 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 21 ms 9108 KB
sample_02.txt AC 81 ms 8984 KB
sample_03.txt AC 58 ms 9036 KB
subtask_1_1.txt AC 24 ms 8992 KB
subtask_1_10.txt AC 267 ms 14732 KB
subtask_1_11.txt AC 22 ms 8884 KB
subtask_1_12.txt AC 219 ms 22432 KB
subtask_1_13.txt AC 27 ms 9120 KB
subtask_1_14.txt AC 123 ms 12880 KB
subtask_1_15.txt AC 413 ms 22376 KB
subtask_1_16.txt AC 66 ms 9172 KB
subtask_1_17.txt AC 64 ms 9116 KB
subtask_1_18.txt AC 323 ms 22396 KB
subtask_1_2.txt AC 159 ms 10280 KB
subtask_1_3.txt AC 125 ms 15636 KB
subtask_1_4.txt AC 116 ms 9028 KB
subtask_1_5.txt AC 227 ms 22440 KB
subtask_1_6.txt AC 147 ms 9772 KB
subtask_1_7.txt AC 86 ms 9108 KB
subtask_1_8.txt AC 399 ms 22624 KB
subtask_1_9.txt AC 370 ms 21096 KB