結果

問題 No.617 Nafmo、買い出しに行く
ユーザー liny_tailliny_tail
提出日時 2020-09-17 23:28:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 911 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 8,264 KB
最終ジャッジ日時 2023-09-04 08:02:29
合計ジャッジ時間 9,117 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,224 KB
testcase_01 AC 16 ms
8,264 KB
testcase_02 AC 17 ms
8,028 KB
testcase_03 AC 68 ms
8,092 KB
testcase_04 AC 16 ms
8,092 KB
testcase_05 AC 124 ms
8,160 KB
testcase_06 AC 882 ms
8,148 KB
testcase_07 AC 911 ms
8,176 KB
testcase_08 AC 15 ms
8,164 KB
testcase_09 AC 16 ms
8,104 KB
testcase_10 AC 897 ms
8,212 KB
testcase_11 AC 886 ms
8,044 KB
testcase_12 AC 897 ms
8,208 KB
testcase_13 AC 796 ms
8,068 KB
testcase_14 AC 879 ms
8,208 KB
testcase_15 AC 408 ms
8,188 KB
testcase_16 AC 405 ms
8,248 KB
testcase_17 AC 401 ms
8,072 KB
testcase_18 AC 16 ms
8,264 KB
testcase_19 AC 16 ms
8,096 KB
testcase_20 AC 16 ms
8,028 KB
testcase_21 AC 16 ms
8,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, K = [int(i) for i in input().strip().split(' ')]
A = [int(input().strip()) for _ in range(N)]

ans = 0

for i in range(1, N+1):
  for j in itertools.combinations(A, r=i):
    ans = max(ans, sum(j)) if sum(j) <= K else ans

print(ans)
0