結果

問題 No.156 キャンディー・ボックス
ユーザー brthyyjpbrthyyjp
提出日時 2021-01-31 16:57:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,306 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 76,620 KB
最終ジャッジ日時 2024-06-29 01:45:10
合計ジャッジ時間 6,896 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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