結果

問題 No.617 Nafmo、買い出しに行く
ユーザー 👑 rin204rin204
提出日時 2020-09-08 07:29:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 76,948 KB
最終ジャッジ日時 2023-08-19 17:32:36
合計ジャッジ時間 6,933 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
76,168 KB
testcase_01 AC 64 ms
71,420 KB
testcase_02 AC 71 ms
76,340 KB
testcase_03 AC 91 ms
76,704 KB
testcase_04 AC 64 ms
71,424 KB
testcase_05 AC 104 ms
76,780 KB
testcase_06 AC 443 ms
76,696 KB
testcase_07 AC 435 ms
76,632 KB
testcase_08 AC 62 ms
71,328 KB
testcase_09 AC 64 ms
71,312 KB
testcase_10 AC 427 ms
76,720 KB
testcase_11 AC 426 ms
76,740 KB
testcase_12 AC 446 ms
76,764 KB
testcase_13 AC 305 ms
76,752 KB
testcase_14 AC 444 ms
76,552 KB
testcase_15 AC 437 ms
76,752 KB
testcase_16 AC 436 ms
76,776 KB
testcase_17 AC 433 ms
76,948 KB
testcase_18 AC 59 ms
71,372 KB
testcase_19 AC 59 ms
71,368 KB
testcase_20 AC 60 ms
71,268 KB
testcase_21 AC 61 ms
71,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
n, k = map(int, input().split())
ans = 0
alst = [int(input()) for _ in range(n)]
for lst in itertools.product([True, False], repeat = n):
    cnt = 0
    for t, a in zip(lst, alst):
        if t:
            cnt += a
    if cnt <= k:
        ans = max(ans, cnt)
print(ans)
0