結果

問題 No.156 キャンディー・ボックス
ユーザー togatogatogatoga
提出日時 2015-08-22 13:57:30
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,642 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 77,404 KB
実行使用メモリ 81,508 KB
最終ジャッジ日時 2023-09-25 16:09:35
合計ジャッジ時間 12,078 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
79,796 KB
testcase_01 AC 80 ms
77,980 KB
testcase_02 AC 79 ms
77,892 KB
testcase_03 AC 82 ms
77,964 KB
testcase_04 AC 81 ms
77,932 KB
testcase_05 AC 190 ms
80,852 KB
testcase_06 AC 266 ms
80,408 KB
testcase_07 AC 243 ms
81,044 KB
testcase_08 AC 202 ms
80,740 KB
testcase_09 AC 165 ms
80,296 KB
testcase_10 AC 229 ms
80,524 KB
testcase_11 AC 180 ms
80,684 KB
testcase_12 AC 278 ms
80,460 KB
testcase_13 AC 236 ms
80,684 KB
testcase_14 AC 178 ms
80,656 KB
testcase_15 AC 232 ms
80,460 KB
testcase_16 AC 164 ms
80,524 KB
testcase_17 AC 212 ms
80,604 KB
testcase_18 AC 144 ms
80,116 KB
testcase_19 AC 165 ms
80,384 KB
testcase_20 AC 86 ms
79,476 KB
testcase_21 AC 132 ms
80,696 KB
testcase_22 AC 164 ms
81,388 KB
testcase_23 AC 145 ms
80,644 KB
testcase_24 AC 79 ms
77,948 KB
testcase_25 AC 80 ms
78,232 KB
testcase_26 AC 79 ms
78,300 KB
testcase_27 AC 81 ms
77,808 KB
testcase_28 AC 82 ms
77,780 KB
testcase_29 AC 81 ms
78,016 KB
testcase_30 AC 321 ms
80,956 KB
testcase_31 AC 245 ms
80,660 KB
testcase_32 AC 1,642 ms
81,432 KB
testcase_33 AC 1,642 ms
81,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N,M = map(int,raw_input().split())
C = map(int, raw_input().split())
heapq.heapify(C)
ans = 0
while (M):
    a = heapq.heappop(C)
    a -= 1
    M -=1
    if (a != 0):
        heapq.heappush(C, a)
    else:
        ans += 1
print ans
0