結果

問題 No.617 Nafmo、買い出しに行く
ユーザー vwxyzvwxyz
提出日時 2022-05-12 22:50:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 232 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 12,232 KB
最終ジャッジ日時 2023-09-27 23:17:56
合計ジャッジ時間 4,681 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 14 ms
7,896 KB
testcase_02 AC 18 ms
7,772 KB
testcase_03 AC 160 ms
7,832 KB
testcase_04 AC 13 ms
7,940 KB
testcase_05 AC 319 ms
7,792 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 13 ms
7,828 KB
testcase_09 AC 14 ms
7,776 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 AC 14 ms
7,792 KB
testcase_19 AC 13 ms
7,824 KB
testcase_20 AC 13 ms
7,932 KB
testcase_21 AC 14 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,K=map(int,readline().split())
A=[int(readline()) for i in range(N)]
ans=0
for bit in range(1<<N):
    S=sum(A[i] for i in range(N) if bit&1<<i)
    if S<=K:
        ans=max(ans,S)
print(ans)
0