結果

問題 No.2317 Expression Menu
ユーザー miho-4
提出日時 2023-05-26 21:59:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 262,976 KB
最終ジャッジ日時 2024-12-25 06:54:38
合計ジャッジ時間 53,349 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 19 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y=map(int,input().split())
L=[list(map(int,input().split())) for _ in range(n)]
d=dict()
d[(0,0)]=0
S={(0,0)}
ans=0
for a,b,c in L:
  nx={(0,0)}
  for A,B in S:
    v=d[(A,B)]
    if A+a<=x and B+b<=y:
      ans=max(ans,v+c)
      nx.add((A+a,B+b))
      if (A+a,B+b) not in d:
        d[(A+a,B+b)]=v+c
      else:
        if d[(A+a,B+b)]<v+c:
          d[(A+a,B+b)]=v+c

  S|=nx
#  print(S)
print(ans)
0