結果

問題 No.2329 Nafmo、イカサマをする
コンテスト
ユーザー とりゐ
提出日時 2023-05-28 14:19:21
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 156 ms / 2,000 ms
+ 728µs
コード長 412 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 89 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 88,960 KB
最終ジャッジ日時 2026-12-01 00:35:04
合計ジャッジ時間 4,554 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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