結果

問題 No.156 キャンディー・ボックス
ユーザー brthyyjpbrthyyjp
提出日時 2021-01-31 16:57:29
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,859 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 78,804 KB
最終ジャッジ日時 2023-09-11 11:03:31
合計ジャッジ時間 10,327 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
76,700 KB
testcase_01 AC 74 ms
71,412 KB
testcase_02 AC 76 ms
71,220 KB
testcase_03 AC 77 ms
71,260 KB
testcase_04 AC 77 ms
71,528 KB
testcase_05 AC 178 ms
77,712 KB
testcase_06 AC 251 ms
77,896 KB
testcase_07 AC 217 ms
77,892 KB
testcase_08 AC 187 ms
77,652 KB
testcase_09 AC 155 ms
77,620 KB
testcase_10 AC 207 ms
78,280 KB
testcase_11 AC 170 ms
78,340 KB
testcase_12 AC 231 ms
78,804 KB
testcase_13 AC 198 ms
78,512 KB
testcase_14 AC 171 ms
78,552 KB
testcase_15 AC 213 ms
78,312 KB
testcase_16 AC 154 ms
77,748 KB
testcase_17 AC 198 ms
78,208 KB
testcase_18 AC 144 ms
77,468 KB
testcase_19 AC 156 ms
77,924 KB
testcase_20 AC 84 ms
76,440 KB
testcase_21 AC 123 ms
77,564 KB
testcase_22 AC 149 ms
77,996 KB
testcase_23 AC 134 ms
77,808 KB
testcase_24 AC 78 ms
71,360 KB
testcase_25 AC 78 ms
71,360 KB
testcase_26 AC 77 ms
71,340 KB
testcase_27 AC 78 ms
71,552 KB
testcase_28 AC 79 ms
71,612 KB
testcase_29 AC 78 ms
71,412 KB
testcase_30 AC 310 ms
77,888 KB
testcase_31 AC 241 ms
77,188 KB
testcase_32 AC 1,744 ms
77,816 KB
testcase_33 AC 1,859 ms
77,896 KB
権限があれば一括ダウンロードができます

ソースコード

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