結果

問題 No.2317 Expression Menu
ユーザー gyozasukisukigyozasukisuki
提出日時 2023-05-26 22:08:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,315 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 206,252 KB
実行使用メモリ 117,696 KB
最終ジャッジ日時 2023-08-26 11:46:10
合計ジャッジ時間 8,590 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
117,476 KB
testcase_01 AC 92 ms
117,484 KB
testcase_02 AC 93 ms
117,676 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 155 ms
117,372 KB
testcase_24 AC 155 ms
117,420 KB
testcase_25 AC 155 ms
117,512 KB
testcase_26 AC 151 ms
117,608 KB
testcase_27 AC 150 ms
117,516 KB
testcase_28 AC 155 ms
117,532 KB
testcase_29 AC 148 ms
117,384 KB
testcase_30 AC 149 ms
117,696 KB
testcase_31 AC 155 ms
117,480 KB
testcase_32 AC 151 ms
117,572 KB
testcase_33 AC 93 ms
117,376 KB
testcase_34 AC 91 ms
117,508 KB
testcase_35 AC 89 ms
117,528 KB
testcase_36 AC 90 ms
117,480 KB
testcase_37 AC 91 ms
117,592 KB
testcase_38 WA -
testcase_39 AC 157 ms
117,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
const int INF = 1e9;
using ll = long long;
using inv = vector<int>;
using stv = vector<string>;
using pint = pair<int,int>;
#define FOR(i,l,r) for(int i=(l); i<(r); i++)
#define rep(i,r) for(int i=0; i<(r); i++)
#define repl(i,r) for(long long i=0; i<(r); i++)
#define FORl(i,l,r) for(long long i=(l); i<(r); i++)
#define INFL ((1LL<<62)-(1LL<<31))
#define pb(x) push_back(x)
#define CIN(x) cin >> x

const ll MOD = 1e9+7;

int N,X,Y;

inv A(305),B(305),C(305);

vector<vector<inv>> memo(305,vector<inv>(305,inv(305,-1)));

int main(){
    
    cin >> N >> X >> Y;

    rep(i,N) cin >> A[i] >> B[i] >> C[i];
    memo[0][X][Y] = 0;
    // rep(j,X+1) rep(k,Y+1){
    //     memo[0][j][k] = 0;
    // }

    FOR(i,1,N+1){
        rep(j,X+1){
            rep(k,Y+1){
                //if(memo[i-1][j][k] == -1) continue;
                
                if(j >= A[i-1] && k >= B[i-1]){
                    memo[i][j-A[i-1]][k-B[i-1]] = max(memo[i][j-A[i-1]][k-B[i-1]],memo[i-1][j][k]+C[i-1]);
                }
                
                memo[i][j][k] = memo[i-1][j][k];
            }
        }

    }

    int ans = -1;

    rep(j,X+1) rep(k,Y+1) ans = max(ans,memo[N][j][k]);
    cout << ans << endl;

    
    
}
0