結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
117,488 KB
testcase_01 AC 89 ms
117,428 KB
testcase_02 AC 90 ms
117,508 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 132 ms
117,576 KB
testcase_24 AC 131 ms
117,516 KB
testcase_25 AC 130 ms
117,504 KB
testcase_26 AC 128 ms
117,400 KB
testcase_27 AC 130 ms
117,576 KB
testcase_28 AC 130 ms
117,412 KB
testcase_29 AC 131 ms
117,512 KB
testcase_30 AC 132 ms
117,520 KB
testcase_31 AC 132 ms
117,696 KB
testcase_32 AC 130 ms
117,512 KB
testcase_33 AC 90 ms
117,568 KB
testcase_34 AC 87 ms
117,456 KB
testcase_35 AC 89 ms
117,512 KB
testcase_36 AC 88 ms
117,408 KB
testcase_37 AC 89 ms
117,504 KB
testcase_38 WA -
testcase_39 AC 114 ms
117,616 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