結果

問題 No.2317 Expression Menu
ユーザー Yaowei Lyu
提出日時 2023-05-26 21:31:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 3,510 ms
コンパイル使用メモリ 249,012 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 05:12:26
合計ジャッジ時間 5,361 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, x, y;
    cin >> n >> x >> y;
    i64 ans = 0;
    vector dp(x + 1, vector<i64>(y + 1));
    for (int i = 0, a, b, c; i < n; i += 1) {
        cin >> a >> b >> c;
        for (int j = x; j >= a; j -= 1) {
            for (int k = y; k >= b; k -= 1) {
                ans = max(ans, dp[j][k] = max(dp[j][k], dp[j - a][k - b] + c));
            }
        }
    }
    cout << ans;
}
0