結果

問題 No.617 Nafmo、買い出しに行く
ユーザー 👑 Nafmo2Nafmo2
提出日時 2020-05-03 18:24:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 730 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 86,584 KB
実行使用メモリ 222,080 KB
最終ジャッジ日時 2023-09-03 23:06:41
合計ジャッジ時間 9,578 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
76,432 KB
testcase_01 AC 70 ms
71,132 KB
testcase_02 AC 83 ms
76,452 KB
testcase_03 AC 112 ms
82,640 KB
testcase_04 AC 69 ms
70,972 KB
testcase_05 AC 136 ms
90,364 KB
testcase_06 AC 678 ms
221,484 KB
testcase_07 AC 730 ms
221,876 KB
testcase_08 AC 69 ms
71,316 KB
testcase_09 AC 68 ms
71,028 KB
testcase_10 AC 628 ms
222,080 KB
testcase_11 AC 635 ms
221,836 KB
testcase_12 AC 636 ms
221,756 KB
testcase_13 AC 626 ms
192,908 KB
testcase_14 AC 634 ms
221,512 KB
testcase_15 AC 587 ms
146,588 KB
testcase_16 AC 589 ms
146,440 KB
testcase_17 AC 602 ms
146,276 KB
testcase_18 AC 70 ms
71,024 KB
testcase_19 AC 69 ms
70,952 KB
testcase_20 AC 69 ms
71,264 KB
testcase_21 AC 69 ms
71,316 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