結果

問題 No.2317 Expression Menu
ユーザー ruthenruthen
提出日時 2023-05-26 23:23:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 1,040 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 205,460 KB
実行使用メモリ 4,820 KB
最終ジャッジ日時 2023-08-26 13:50:31
合計ジャッジ時間 6,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 6 ms
4,564 KB
testcase_03 AC 63 ms
4,464 KB
testcase_04 AC 63 ms
4,560 KB
testcase_05 AC 64 ms
4,568 KB
testcase_06 AC 63 ms
4,440 KB
testcase_07 AC 64 ms
4,548 KB
testcase_08 AC 64 ms
4,640 KB
testcase_09 AC 67 ms
4,500 KB
testcase_10 AC 68 ms
4,652 KB
testcase_11 AC 66 ms
4,440 KB
testcase_12 AC 66 ms
4,460 KB
testcase_13 AC 65 ms
4,464 KB
testcase_14 AC 67 ms
4,456 KB
testcase_15 AC 67 ms
4,488 KB
testcase_16 AC 66 ms
4,512 KB
testcase_17 AC 67 ms
4,456 KB
testcase_18 AC 66 ms
4,568 KB
testcase_19 AC 67 ms
4,620 KB
testcase_20 AC 66 ms
4,564 KB
testcase_21 AC 66 ms
4,444 KB
testcase_22 AC 64 ms
4,820 KB
testcase_23 AC 79 ms
4,496 KB
testcase_24 AC 79 ms
4,544 KB
testcase_25 AC 79 ms
4,488 KB
testcase_26 AC 79 ms
4,496 KB
testcase_27 AC 79 ms
4,512 KB
testcase_28 AC 79 ms
4,604 KB
testcase_29 AC 84 ms
4,568 KB
testcase_30 AC 80 ms
4,500 KB
testcase_31 AC 84 ms
4,800 KB
testcase_32 AC 82 ms
4,648 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 82 ms
4,456 KB
testcase_39 AC 84 ms
4,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); i++)
template<class T> using V = vector<T>;

template<class T>
ostream &operator<<(ostream &os, const V<T> &v) {
    os << "[ ";
    for (auto &vi: v) os << vi << ", ";
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    return os << "{ " << p.first << ", " << p.second << "}";
}

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << x << endl;
#else
#define show(x) true
#endif

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    vector dp(X + 1, vector(Y + 1, 0LL));
    REP(i, N) {
        int a, b, c;
        cin >> a >> b >> c;
        auto np = dp;
        for (int x = 0; x <= X - a; x++) {
            for (int y = 0; y <= Y - b; y++) {
                np[x + a][y + b] = max(np[x + a][y + b], dp[x][y] + c);
            }
        }
        swap(dp, np);
    }
    long long ans = dp[X][Y];
    cout << ans << '\n';
    return 0;
}
0