結果

問題 No.617 Nafmo、買い出しに行く
ユーザー first_vilfirst_vil
提出日時 2020-08-04 10:21:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 192 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 77,732 KB
最終ジャッジ日時 2023-10-12 09:16:32
合計ジャッジ時間 7,011 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,768 KB
testcase_01 AC 73 ms
71,140 KB
testcase_02 AC 88 ms
76,636 KB
testcase_03 AC 109 ms
77,400 KB
testcase_04 AC 74 ms
71,468 KB
testcase_05 AC 132 ms
77,284 KB
testcase_06 AC 458 ms
77,328 KB
testcase_07 AC 459 ms
77,300 KB
testcase_08 AC 73 ms
71,644 KB
testcase_09 AC 71 ms
71,640 KB
testcase_10 AC 450 ms
77,424 KB
testcase_11 AC 455 ms
77,540 KB
testcase_12 AC 453 ms
77,208 KB
testcase_13 AC 457 ms
77,372 KB
testcase_14 AC 447 ms
77,376 KB
testcase_15 AC 462 ms
77,156 KB
testcase_16 AC 475 ms
77,732 KB
testcase_17 AC 467 ms
77,280 KB
testcase_18 AC 72 ms
71,344 KB
testcase_19 AC 71 ms
71,444 KB
testcase_20 AC 74 ms
71,288 KB
testcase_21 AC 74 ms
71,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=[int(input()) for _ in range(n)]
ans=0
for bit in range(1<<n):
  res=sum([((bit&(1<<i))>>i)*a[i] for i in range(n)])
  if res<=k:
    ans=max(ans,res)
print(ans)
0