結果

問題 No.2317 Expression Menu
ユーザー Ekiben542Ekiben542
提出日時 2023-05-26 22:00:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 798 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 71,464 KB
実行使用メモリ 5,272 KB
最終ジャッジ日時 2023-08-26 11:32:02
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 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 31 ms
4,380 KB
testcase_24 AC 30 ms
4,384 KB
testcase_25 AC 30 ms
4,380 KB
testcase_26 AC 30 ms
4,380 KB
testcase_27 AC 29 ms
4,376 KB
testcase_28 AC 30 ms
4,380 KB
testcase_29 AC 31 ms
4,376 KB
testcase_30 AC 30 ms
4,380 KB
testcase_31 AC 30 ms
4,376 KB
testcase_32 AC 29 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 WA -
testcase_39 AC 24 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    
    vector<vector<int>> dp(X + 1, vector<int>(Y + 1, -1));
    dp[0][0] = 0;
    
    for (int k = 0; k < N; k++) {
        int A, B, C;
        cin >> A >> B >> C;
        
        for (int i = X - A; i >= 0; i--) {
            for (int j = Y - B; j >= 0; j--) {
                if (dp[i][j] != -1) {
                    dp[i + A][j + B] = max(dp[i + A][j + B], dp[i][j] + C);
                }
            }
        }
    }
    
    int ans = 0;
    for (int i = 0; i <= X; i++) {
        for (int j = 0; j <= Y; j++) {
            if (dp[i][j] != -1) {
                ans = max(ans, dp[i][j]);
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}
0