結果

問題 No.156 キャンディー・ボックス
ユーザー c-yanc-yan
提出日時 2020-07-15 21:21:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 308 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-05-02 02:23:59
合計ジャッジ時間 2,609 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 30 ms
10,880 KB
testcase_19 AC 30 ms
10,880 KB
testcase_20 RE -
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 31 ms
10,752 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 31 ms
10,880 KB
testcase_29 AC 31 ms
10,752 KB
testcase_30 RE -
testcase_31 AC 31 ms
10,880 KB
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

N, M, *C = map(int, open(0).read().split())

heapify(C)
while M != 0:
    if len(C) == 0:
        print(N)
        break
    t = heappop(C)
    u = min((C[0] - t) + 1, t, M)
    t -= u
    M -= u
    if t != 0:
        heappush(C, t)
else:
    print(N - len(C))
0