結果
問題 | No.2317 Expression Menu |
ユーザー |
|
提出日時 | 2023-05-26 22:25:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 1,773 ms |
コンパイル使用メモリ | 172,772 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-12-25 08:15:07 |
合計ジャッジ時間 | 4,397 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
//yukicoder390D#include<bits/stdc++.h>using namespace std;typedef int64_t ll;int main(){int n,x,y; cin>>n>>x>>y;vector<vector<ll>> V(700,vector<ll>(700,0));//答えより1だけ大きい数を記録V.at(0).at(0)=1;while(n--){int a,b,c; cin>>a>>b>>c;for(int i=x;i>=0;i--){for(int j=y;j>=0;j--){if(V.at(i).at(j)==(ll)0)continue;ll &v=V.at(i+a).at(j+b);v=max(v,V.at(i).at(j)+c);}}}ll ans=0;for(int i=0;i<=x;i++){for(int j=0;j<=y;j++){ans=max(ans,V.at(i).at(j));}}cout<<ans-1<<endl;return 0;}