結果

問題 No.617 Nafmo、買い出しに行く
ユーザー matriematrie
提出日時 2020-12-18 01:43:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 292 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 11,976 KB
実行使用メモリ 14,516 KB
最終ジャッジ日時 2023-10-21 07:44:14
合計ジャッジ時間 5,678 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,196 KB
testcase_01 AC 31 ms
10,192 KB
testcase_02 AC 41 ms
10,196 KB
testcase_03 AC 419 ms
10,196 KB
testcase_04 AC 30 ms
10,196 KB
testcase_05 AC 830 ms
10,196 KB
testcase_06 AC 29 ms
10,192 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
l=[int(input()) for _ in range(n)]
if k in l: print(k); exit
l=[x for x in l if x<k]
m=len(l)
a=0
for i in reversed(range(2**m)):
	s=list(format(i,'0'+str(m)+'b'))
	s=list(map(int,s))
	x=[a*b for a,b in zip(l,s)]
	if a<sum(x)<=k: a=sum(x)
	if a==k: break
print(a)
0