結果

問題 No.617 Nafmo、買い出しに行く
ユーザー utsumidaisukeutsumidaisuke
提出日時 2018-12-19 17:32:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 338 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 27,324 KB
最終ジャッジ日時 2023-10-25 23:57:46
合計ジャッジ時間 9,248 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,140 KB
testcase_01 AC 26 ms
10,132 KB
testcase_02 AC 28 ms
10,236 KB
testcase_03 AC 78 ms
13,600 KB
testcase_04 AC 27 ms
10,136 KB
testcase_05 AC 132 ms
18,548 KB
testcase_06 AC 743 ms
10,140 KB
testcase_07 AC 721 ms
10,140 KB
testcase_08 RE -
testcase_09 AC 27 ms
10,132 KB
testcase_10 AC 813 ms
27,324 KB
testcase_11 AC 792 ms
27,324 KB
testcase_12 AC 785 ms
27,324 KB
testcase_13 AC 794 ms
27,324 KB
testcase_14 AC 777 ms
27,324 KB
testcase_15 RE -
testcase_16 AC 760 ms
18,548 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 27 ms
10,132 KB
testcase_20 AC 27 ms
10,132 KB
testcase_21 AC 27 ms
10,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as it

n, mx = map(int, input().split())

seq = []
for i in range(n):
    inp = int(input())
    seq.append(inp)
    
sm = set()
for i in range(n):
    for j in it.combinations(seq,i+1):
        ans = sum(list(j))
        sm.add(ans)

if mx in sm:
    print(mx)
else:
    ls = [i for i in sm if i < mx]
    print(max(ls))
0