結果

問題 No.156 キャンディー・ボックス
ユーザー togatogatogatoga
提出日時 2015-08-22 13:57:03
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 247 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 6,600 KB
実行使用メモリ 10,484 KB
最終ジャッジ日時 2023-09-25 16:09:22
合計ジャッジ時間 13,164 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
10,484 KB
testcase_01 AC 12 ms
6,044 KB
testcase_02 AC 12 ms
6,060 KB
testcase_03 AC 12 ms
6,160 KB
testcase_04 AC 12 ms
6,244 KB
testcase_05 AC 243 ms
6,184 KB
testcase_06 AC 604 ms
6,252 KB
testcase_07 AC 446 ms
6,144 KB
testcase_08 AC 326 ms
6,180 KB
testcase_09 AC 199 ms
6,136 KB
testcase_10 AC 406 ms
6,180 KB
testcase_11 AC 200 ms
6,088 KB
testcase_12 AC 572 ms
6,204 KB
testcase_13 AC 360 ms
6,044 KB
testcase_14 AC 200 ms
6,344 KB
testcase_15 AC 426 ms
6,132 KB
testcase_16 AC 209 ms
6,124 KB
testcase_17 AC 349 ms
6,272 KB
testcase_18 AC 181 ms
6,124 KB
testcase_19 AC 213 ms
6,048 KB
testcase_20 AC 17 ms
6,072 KB
testcase_21 AC 62 ms
6,068 KB
testcase_22 AC 164 ms
6,288 KB
testcase_23 AC 83 ms
6,204 KB
testcase_24 AC 12 ms
6,200 KB
testcase_25 AC 12 ms
6,044 KB
testcase_26 AC 12 ms
6,168 KB
testcase_27 AC 12 ms
6,128 KB
testcase_28 AC 12 ms
6,172 KB
testcase_29 AC 12 ms
6,072 KB
testcase_30 AC 1,072 ms
6,312 KB
testcase_31 AC 725 ms
6,284 KB
testcase_32 TLE -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

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