結果

問題 No.2317 Expression Menu
ユーザー i_am_noob
提出日時 2023-06-29 19:22:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 192,360 KB
最終ジャッジ日時 2025-02-15 03:09:07
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())

const int N=305;
int n,x,y;
ll dp[N][N];

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n >> x >> y;
    for(int _=0; _<n; ++_){
        int a,b,c; cin >> a >> b >> c;
        for(int i=x-a; i>=0; --i) for(int j=y-b; j>=0; --j) dp[i+a][j+b]=max(dp[i+a][j+b],dp[i][j]+c);
    }
    cout << dp[x][y] << "\n";
}
0