結果

問題 No.617 Nafmo、買い出しに行く
ユーザー fV9TwBhUoa9S3eVfV9TwBhUoa9S3eV
提出日時 2019-10-23 13:42:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 905 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 81,684 KB
最終ジャッジ日時 2023-09-20 11:14:54
合計ジャッジ時間 10,012 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,296 KB
testcase_01 AC 16 ms
8,068 KB
testcase_02 AC 18 ms
8,512 KB
testcase_03 AC 67 ms
13,776 KB
testcase_04 AC 16 ms
8,260 KB
testcase_05 AC 123 ms
18,324 KB
testcase_06 AC 904 ms
81,544 KB
testcase_07 AC 900 ms
81,580 KB
testcase_08 AC 17 ms
8,144 KB
testcase_09 AC 16 ms
8,200 KB
testcase_10 AC 896 ms
81,536 KB
testcase_11 AC 902 ms
81,684 KB
testcase_12 AC 900 ms
81,684 KB
testcase_13 AC 842 ms
80,312 KB
testcase_14 AC 905 ms
81,680 KB
testcase_15 AC 577 ms
56,184 KB
testcase_16 AC 579 ms
56,240 KB
testcase_17 AC 572 ms
56,236 KB
testcase_18 AC 16 ms
8,092 KB
testcase_19 AC 16 ms
8,196 KB
testcase_20 AC 16 ms
8,256 KB
testcase_21 AC 16 ms
8,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.617 Nafmo、買い出しに行く
import itertools

n, k = [int(s) for s in input().split()]
a = []

for i in range(n):
    a.append(int(input()))

weight = []

for i in range(n + 1):
    s = list(itertools.combinations(a, i))
    
    for j in s:
        if k >= sum(j):
            weight.append(sum(j))

print(max(weight))
0