結果

問題 No.617 Nafmo、買い出しに行く
ユーザー okadukiokaduki
提出日時 2017-12-18 19:13:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 478 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 1,086 ms
コンパイル使用メモリ 86,488 KB
実行使用メモリ 77,508 KB
最終ジャッジ日時 2023-08-22 05:46:03
合計ジャッジ時間 8,359 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
76,700 KB
testcase_01 AC 109 ms
71,988 KB
testcase_02 AC 123 ms
76,952 KB
testcase_03 AC 142 ms
77,508 KB
testcase_04 AC 108 ms
71,864 KB
testcase_05 AC 162 ms
77,356 KB
testcase_06 AC 466 ms
77,012 KB
testcase_07 AC 461 ms
77,204 KB
testcase_08 AC 110 ms
72,012 KB
testcase_09 AC 109 ms
72,000 KB
testcase_10 AC 464 ms
77,180 KB
testcase_11 AC 461 ms
77,220 KB
testcase_12 AC 466 ms
77,204 KB
testcase_13 AC 464 ms
77,172 KB
testcase_14 AC 471 ms
77,172 KB
testcase_15 AC 472 ms
77,256 KB
testcase_16 AC 478 ms
77,496 KB
testcase_17 AC 471 ms
77,340 KB
testcase_18 AC 111 ms
72,144 KB
testcase_19 AC 110 ms
72,140 KB
testcase_20 AC 110 ms
72,020 KB
testcase_21 AC 109 ms
72,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce

n,k = [int(x) for x in input().split()]
xs = [int(input()) for _ in range(n)]

ans = 0
for b in range(0,1<<n):
    s = reduce(lambda iv, x: (iv[0]+1, iv[1]+(x if b>>iv[0]&1 else 0)), xs, (0,0))
    if s[1] <= k: ans = max(ans, s[1])
print(ans)
0