Submission #6834875


Source Code Expand

Copy
<?php
fscanf(STDIN, '%d %d', $n, $m);
$s = array_fill(1, $m, NULL);
for ($i  = 0; $i < $n; $i++) {
    fscanf(STDIN, '%d %d', $a, $b);
    $s[$a][] = $b;
}

$cnt = 0;
$q = new SplPriorityQueue();
for ($i = 1; $i <= $m; $i++) {
    foreach ($s[$i] as $v) {
        $q->insert($v, $v);
    }
    if (!$q->isEmpty()) $cnt += $q->extract();
}
echo $cnt.PHP_EOL;

Submission Info

Submission Time
Task D - Summer Vacation
User hideyuk1
Language PHP7 (7.0.15)
Score 400
Code Size 373 Byte
Status
Exec Time 559 ms
Memory 59896 KB

Test Cases

Set Name Score / Max Score Test Cases
All 400 / 400 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 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 13 ms 4728 KB
sample_02 10 ms 4604 KB
sample_03 10 ms 4604 KB
testcase_01 99 ms 12792 KB
testcase_02 61 ms 12792 KB
testcase_03 99 ms 29432 KB
testcase_04 241 ms 31224 KB
testcase_05 258 ms 31224 KB
testcase_06 123 ms 27128 KB
testcase_07 223 ms 47608 KB
testcase_08 144 ms 20984 KB
testcase_09 367 ms 43512 KB
testcase_10 559 ms 59896 KB
testcase_11 389 ms 53752 KB
testcase_12 96 ms 18936 KB
testcase_13 417 ms 59896 KB
testcase_14 230 ms 53752 KB
testcase_15 27 ms 8696 KB
testcase_16 231 ms 59896 KB
testcase_17 73 ms 12792 KB
testcase_18 540 ms 57848 KB