結果

問題 No.617 Nafmo、買い出しに行く
ユーザー takakintakakin
提出日時 2020-05-04 11:46:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 422 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 77,012 KB
最終ジャッジ日時 2023-09-06 05:46:41
合計ジャッジ時間 6,300 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,512 KB
testcase_01 AC 72 ms
71,260 KB
testcase_02 AC 80 ms
76,380 KB
testcase_03 AC 95 ms
76,420 KB
testcase_04 AC 71 ms
71,424 KB
testcase_05 AC 101 ms
76,456 KB
testcase_06 AC 414 ms
76,876 KB
testcase_07 AC 412 ms
77,012 KB
testcase_08 AC 74 ms
71,440 KB
testcase_09 AC 74 ms
71,180 KB
testcase_10 AC 414 ms
76,912 KB
testcase_11 AC 411 ms
76,808 KB
testcase_12 AC 415 ms
76,792 KB
testcase_13 AC 414 ms
76,780 KB
testcase_14 AC 415 ms
76,856 KB
testcase_15 AC 422 ms
76,952 KB
testcase_16 AC 285 ms
76,916 KB
testcase_17 AC 420 ms
76,812 KB
testcase_18 AC 74 ms
71,260 KB
testcase_19 AC 72 ms
71,248 KB
testcase_20 AC 72 ms
71,176 KB
testcase_21 AC 71 ms
71,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
A=[int(input()) for _ in range(n)]
ans=0
for i in range(1<<n):
  cur=0
  for j in range(n):
    if i&1<<j:
      cur+=A[j]
  if cur<=k:
    ans=max(ans,cur)
print(ans)
0