結果

問題 No.2317 Expression Menu
ユーザー otoshigootoshigo
提出日時 2023-05-26 21:36:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 80,120 KB
実行使用メモリ 4,824 KB
最終ジャッジ日時 2023-08-26 10:38:09
合計ジャッジ時間 6,924 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 11 ms
4,616 KB
testcase_03 AC 144 ms
4,480 KB
testcase_04 AC 142 ms
4,780 KB
testcase_05 AC 144 ms
4,608 KB
testcase_06 AC 142 ms
4,560 KB
testcase_07 AC 143 ms
4,604 KB
testcase_08 AC 140 ms
4,600 KB
testcase_09 AC 144 ms
4,500 KB
testcase_10 AC 141 ms
4,468 KB
testcase_11 AC 144 ms
4,524 KB
testcase_12 AC 144 ms
4,684 KB
testcase_13 AC 142 ms
4,532 KB
testcase_14 AC 139 ms
4,548 KB
testcase_15 AC 141 ms
4,656 KB
testcase_16 AC 143 ms
4,480 KB
testcase_17 AC 145 ms
4,536 KB
testcase_18 AC 138 ms
4,544 KB
testcase_19 AC 141 ms
4,540 KB
testcase_20 AC 144 ms
4,656 KB
testcase_21 AC 140 ms
4,604 KB
testcase_22 AC 141 ms
4,472 KB
testcase_23 AC 159 ms
4,668 KB
testcase_24 AC 156 ms
4,824 KB
testcase_25 AC 151 ms
4,476 KB
testcase_26 AC 156 ms
4,480 KB
testcase_27 AC 157 ms
4,472 KB
testcase_28 AC 154 ms
4,540 KB
testcase_29 AC 152 ms
4,564 KB
testcase_30 AC 151 ms
4,476 KB
testcase_31 AC 150 ms
4,608 KB
testcase_32 AC 152 ms
4,676 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
4,420 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 153 ms
4,496 KB
testcase_39 AC 152 ms
4,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,X,Y;
    cin>>N>>X>>Y;
    vector dp(X+1,vector<ll>(Y+1,-1LL<<60));
    dp[0][0]=0;
    rep(i,N){
        int a,b;
        ll c;
        cin>>a>>b>>c;
        vector dp2(X+1,vector<ll>(Y+1,-1LL<<60));
        rep(j,X-a+1)rep(k,Y-b+1){
            chmax(dp2[j+a][k+b],dp[j][k]+c);
        }
        rep(j,X+1)rep(k,Y+1)chmax(dp[j][k],dp2[j][k]);
    }
    ll ans=-1LL<<60;
    rep(i,X+1)rep(j,Y+1)chmax(ans,dp[i][j]);
    cout<<ans<<"\n";
}
0