結果

問題 No.156 キャンディー・ボックス
ユーザー lam6er
提出日時 2025-03-31 17:37:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 291 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 77,236 KB
最終ジャッジ日時 2025-03-31 17:38:18
合計ジャッジ時間 10,233 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n, m = map(int, input().split())
c = list(map(int, input().split()))

heapq.heapify(c)
emptied = 0

for _ in range(m):
    current = heapq.heappop(c)
    new_val = current - 1
    if new_val > 0:
        heapq.heappush(c, new_val)
    else:
        emptied += 1

print(emptied)
0