結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー brthyyjp
提出日時 2021-01-31 16:57:29
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 912 ms / 2,000 ms
+ 464µs
コード長 235 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 686 ms
コンパイル使用メモリ 96,488 KB
実行使用メモリ 84,628 KB
最終ジャッジ日時 2026-08-01 11:34:31
合計ジャッジ時間 7,921 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_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