Submission #7529757
Source Code Expand
Copy
<?phpfscanf(STDIN, '%d %d', $n, $m);$a = array_map('intval', explode(' ', trim(fgets(STDIN))));$q = new SplPriorityQueue;for ($i = 0; $i < $n; $i++) {$q->insert($a[$i], $a[$i]);}$i = 0;while ($i < $m) {$x = $q->extract();$x = $x / 2;$q->insert($x, $x);$i++;}$ans = 0;while ($q->count() > 0) {$ans += (int)floor($q->extract());}echo $ans . PHP_EOL;
<?php fscanf(STDIN, '%d %d', $n, $m); $a = array_map('intval', explode(' ', trim(fgets(STDIN)))); $q = new SplPriorityQueue; for ($i = 0; $i < $n; $i++) { $q->insert($a[$i], $a[$i]); } $i = 0; while ($i < $m) { $x = $q->extract(); $x = $x / 2; $q->insert($x, $x); $i++; } $ans = 0; while ($q->count() > 0) { $ans += (int)floor($q->extract()); } echo $ans . PHP_EOL;
Submission Info
Submission Time | |
---|---|
Task | D - Powerful Discount Tickets |
User | hideyuk1 |
Language | PHP7 (7.0.15) |
Score | 400 |
Code Size | 407 Byte |
Status | AC |
Exec Time | 844 ms |
Memory | 53748 KB |
Judge Result
Set Name | All | Sample | ||||
---|---|---|---|---|---|---|
Score / Max Score | 400 / 400 | 0 / 0 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
All | sample_01, sample_02, sample_03, sample_04, 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, testcase_19 |
Sample | sample_01, sample_02, sample_03, sample_04 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01 | AC | 12 ms | 4728 KB |
sample_02 | AC | 9 ms | 4604 KB |
sample_03 | AC | 37 ms | 4604 KB |
sample_04 | AC | 9 ms | 4604 KB |
testcase_01 | AC | 277 ms | 33272 KB |
testcase_02 | AC | 185 ms | 8696 KB |
testcase_03 | AC | 483 ms | 51700 KB |
testcase_04 | AC | 844 ms | 53748 KB |
testcase_05 | AC | 123 ms | 27128 KB |
testcase_06 | AC | 577 ms | 47604 KB |
testcase_07 | AC | 53 ms | 14840 KB |
testcase_08 | AC | 366 ms | 53748 KB |
testcase_09 | AC | 449 ms | 35320 KB |
testcase_10 | AC | 146 ms | 12792 KB |
testcase_11 | AC | 390 ms | 41460 KB |
testcase_12 | AC | 735 ms | 53748 KB |
testcase_13 | AC | 154 ms | 6648 KB |
testcase_14 | AC | 262 ms | 53748 KB |
testcase_15 | AC | 735 ms | 53748 KB |
testcase_16 | AC | 211 ms | 10744 KB |
testcase_17 | AC | 9 ms | 4604 KB |
testcase_18 | AC | 9 ms | 4604 KB |
testcase_19 | AC | 93 ms | 53748 KB |