結果

問題 No.617 Nafmo、買い出しに行く
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-02 23:39:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 85,928 KB
最終ジャッジ日時 2023-08-14 18:53:01
合計ジャッジ時間 7,894 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,296 KB
testcase_01 AC 16 ms
8,120 KB
testcase_02 AC 19 ms
8,480 KB
testcase_03 AC 147 ms
14,164 KB
testcase_04 AC 14 ms
8,136 KB
testcase_05 AC 297 ms
19,428 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 RE -
testcase_09 AC 17 ms
8,308 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 RE -
testcase_19 AC 15 ms
8,172 KB
testcase_20 AC 16 ms
8,192 KB
testcase_21 AC 16 ms
8,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

input_list = list(map(int,input().split()))
n, k = input_list
a_list = []
a_list = [int(input()) for i in range(n)]

res_list = []

for sign in range(1, n + 1):
    cur_list = list(itertools.combinations(range(0, n), sign))
    for i in range(len(cur_list)):
        cur_sum = 0
        for j in range(sign):
            cur_sum += a_list[cur_list[i][j]]
        res_list.append(cur_sum)
        
print(max([e for e in res_list if e <= k]))
0