結果

問題 No.156 キャンディー・ボックス
コンテスト
ユーザー Hachimori
提出日時 2015-03-03 23:26:21
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 61 ms / 2,000 ms
+ 755µs
コード長 372 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 70 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 80,896 KB
最終ジャッジ日時 2026-07-17 11:31:03
合計ジャッジ時間 3,855 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python
#coding:utf8

def read():
    N, M = map(int, raw_input().split())
    cList = map(int, raw_input().split())
    return M, cList


def work((M, cList)):
    ans = 0
    
    for C in sorted(cList):
        if C <= M:
            M -= C
            ans += 1
        else:
            break

    print ans


if __name__ == "__main__":
    work(read())
0