結果

問題 No.156 キャンディー・ボックス
ユーザー brthyyjpbrthyyjp
提出日時 2021-09-21 14:49:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 235 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 12,636 KB
最終ジャッジ日時 2023-09-17 00:31:45
合計ジャッジ時間 7,775 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
12,592 KB
testcase_01 AC 16 ms
8,164 KB
testcase_02 AC 16 ms
8,136 KB
testcase_03 AC 16 ms
8,060 KB
testcase_04 AC 16 ms
8,152 KB
testcase_05 AC 105 ms
8,180 KB
testcase_06 AC 215 ms
8,140 KB
testcase_07 AC 169 ms
8,204 KB
testcase_08 AC 144 ms
8,128 KB
testcase_09 AC 102 ms
8,240 KB
testcase_10 AC 167 ms
8,120 KB
testcase_11 AC 90 ms
8,208 KB
testcase_12 AC 207 ms
8,208 KB
testcase_13 AC 141 ms
8,192 KB
testcase_14 AC 94 ms
8,264 KB
testcase_15 AC 164 ms
8,232 KB
testcase_16 AC 100 ms
8,200 KB
testcase_17 AC 149 ms
8,128 KB
testcase_18 AC 61 ms
8,272 KB
testcase_19 AC 69 ms
8,264 KB
testcase_20 AC 19 ms
8,096 KB
testcase_21 AC 31 ms
8,132 KB
testcase_22 AC 58 ms
8,060 KB
testcase_23 AC 37 ms
8,260 KB
testcase_24 AC 16 ms
8,212 KB
testcase_25 AC 16 ms
8,104 KB
testcase_26 AC 16 ms
8,128 KB
testcase_27 AC 15 ms
8,132 KB
testcase_28 AC 15 ms
8,220 KB
testcase_29 AC 16 ms
8,208 KB
testcase_30 AC 544 ms
8,204 KB
testcase_31 AC 192 ms
8,148 KB
testcase_32 TLE -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

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