Submission #13288814


Source Code Expand

Copy
from heapq import heappop,heappush
n,m=map(int,input().split())
L=[[] for _ in range(m)]
for _ in range(n):
  a,b=map(int,input().split())
  if a<=m:
    L[m-a].append(b)
s=0
h=[]
for i in range(m-1,-1,-1):
  for l in L[i][::-1]:
    heappush(h,-l)
  if len(h)>0:
    s-=heappop(h)
print(s)

Submission Info

Submission Time
Task D - Summer Vacation
User snowrabbit
Language Python (3.4.3)
Score 400
Code Size 306 Byte
Status AC
Exec Time 476 ms
Memory 18584 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 21
AC × 3
Set Name Test Cases
All sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 AC 18 ms 3064 KB
sample_02 AC 18 ms 3060 KB
sample_03 AC 18 ms 3064 KB
testcase_01 AC 93 ms 8008 KB
testcase_02 AC 42 ms 5820 KB
testcase_03 AC 260 ms 6700 KB
testcase_04 AC 463 ms 16200 KB
testcase_05 AC 476 ms 16200 KB
testcase_06 AC 277 ms 5832 KB
testcase_07 AC 433 ms 17732 KB
testcase_08 AC 139 ms 7796 KB
testcase_09 AC 301 ms 13352 KB
testcase_10 AC 448 ms 18584 KB
testcase_11 AC 378 ms 16824 KB
testcase_12 AC 115 ms 6976 KB
testcase_13 AC 422 ms 18496 KB
testcase_14 AC 336 ms 17368 KB
testcase_15 AC 45 ms 4212 KB
testcase_16 AC 368 ms 18276 KB
testcase_17 AC 77 ms 5360 KB
testcase_18 AC 446 ms 18328 KB