結果

問題 No.617 Nafmo、買い出しに行く
ユーザー suzukeh1suzukeh1
提出日時 2020-05-03 18:38:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 711 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 222,004 KB
最終ジャッジ日時 2023-09-04 04:32:53
合計ジャッジ時間 9,795 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,068 KB
testcase_01 AC 82 ms
70,936 KB
testcase_02 AC 97 ms
76,116 KB
testcase_03 AC 125 ms
82,280 KB
testcase_04 AC 78 ms
70,784 KB
testcase_05 AC 151 ms
90,628 KB
testcase_06 AC 711 ms
221,744 KB
testcase_07 AC 692 ms
221,428 KB
testcase_08 AC 75 ms
71,028 KB
testcase_09 AC 74 ms
71,168 KB
testcase_10 AC 695 ms
221,868 KB
testcase_11 AC 689 ms
221,548 KB
testcase_12 AC 695 ms
222,004 KB
testcase_13 AC 690 ms
192,592 KB
testcase_14 AC 696 ms
221,400 KB
testcase_15 AC 646 ms
146,376 KB
testcase_16 AC 643 ms
146,396 KB
testcase_17 AC 648 ms
146,504 KB
testcase_18 AC 79 ms
71,040 KB
testcase_19 AC 78 ms
71,056 KB
testcase_20 AC 77 ms
70,888 KB
testcase_21 AC 77 ms
70,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
items = []
Try = []
for shop in range(N):
    items.append(int(input()))

for way in range(2 ** N):
    bug = []
    for item in range(N):
        if ((way >> item) & 1) == 1:
            bug.append(items[item])

    Try.append(sum(bug))

    bug.clear()
movable_items = [i for i in Try if i <= K]
print(max(movable_items))
0