結果

問題 No.2329 Nafmo、イカサマをする
ユーザー とりゐ
提出日時 2023-05-28 14:19:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 89,600 KB
最終ジャッジ日時 2024-12-27 00:31:16
合計ジャッジ時間 3,239 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
a=list(map(int,input().split()))

k1=k//2
k2=k-k1

def get(s):
  if s==0:
    return [0]
  res=get(s-1)
  new=set(res)
  for i in range(n):
    for j in res:
      if a[i]+j<=m:
        new.add(a[i]+j)
  return list(new)

res1=get(k1)
res2=get(k2)
res1.sort()
res2.sort()
ans=0
idx=len(res2)-1
for i in res1:
  while i+res2[idx]>m:
    idx-=1
  ans=max(ans,i+res2[idx])

print(ans)
0