結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー brthyyjp
提出日時 2021-01-31 16:57:29
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 935 ms / 2,000 ms
コード長 235 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 264 ms
コンパイル使用メモリ 85,772 KB
実行使用メモリ 81,540 KB
最終ジャッジ日時 2026-03-18 10:50:24
合計ジャッジ時間 5,604 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, m = map(int, input().split())
C = list(map(int, input().split()))
import heapq
heapq.heapify(C)
ans = 0
for i in range(m):
    c = heapq.heappop(C)
    if c == 1:
        ans += 1
    else:
        heapq.heappush(C, c-1)
print(ans)
0