結果
| 問題 |
No.2317 Expression Menu
|
| コンテスト | |
| ユーザー |
yupooh
|
| 提出日時 | 2023-05-26 21:30:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 527 ms / 2,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 316 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 92,032 KB |
| 最終ジャッジ日時 | 2024-12-25 05:02:17 |
| 合計ジャッジ時間 | 15,786 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
import sys
input = sys.stdin.readline
n,x,y=map(int,input().split())
dp=[[-1]*(y+1) for _ in range(x+1)]
dp[0][0]=0
for _ in range(n):
a,b,c=map(int,input().split())
dp2=[[-1]*(y+1) for _ in range(x+1)]
for i in range(x+1):
for j in range(y+1):
if dp[i][j]==-1:
continue
if i+a<=x and j+b<=y:
dp2[i+a][j+b]=max(dp2[i+a][j+b],dp[i][j]+c)
dp2[i][j]=max(dp2[i][j],dp[i][j])
dp=dp2
ans=0
for i in range(x+1):
for j in range(y+1):
ans=max(ans,dp[i][j])
print(ans)
yupooh