結果
問題 | No.2317 Expression Menu |
ユーザー |
|
提出日時 | 2023-05-26 23:23:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 1,040 bytes |
コンパイル時間 | 1,829 ms |
コンパイル使用メモリ | 199,648 KB |
最終ジャッジ日時 | 2025-02-13 08:34:18 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#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#endifint 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;}