結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー hiro_metal_core
提出日時 2017-11-06 00:02:52
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 385 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 643 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-05-17 23:46:20
合計ジャッジ時間 8,557 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = map(int, input().split())
C = list(map(int, input().split()))

l = len(C)

while(M > 0):
    min_c = 100000
    for i in range(l):
        if (C[i] < min_c and C[i] != 0):
            min_c = C[i]
            min_c_loc = i

    M -= C[min_c_loc]

    if (M >= 0):
        C[min_c_loc] = 0

empty_box = 0

for c in C:
    if (c == 0):
        empty_box += 1
    
print(empty_box)
0