結果
| 問題 | No.2317 Expression Menu |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-01-29 01:01:12 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 744 bytes |
| 記録 | |
| コンパイル時間 | 3,510 ms |
| コンパイル使用メモリ | 343,332 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-29 01:01:22 |
| 合計ジャッジ時間 | 9,559 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, x, y;
cin >> n >> x >> y;
constexpr ll INF = 1e18;
vector dp(x + 1, vector<ll>(y + 1, -INF));
dp[0][0] = 0;
rep(_, n) {
ll a, b, c;
cin >> a >> b >> c;
vector ndp(x + 1, vector<ll>(y + 1, -INF));
rep(i, x + 1) rep(j, y + 1) {
ndp[i][j] = max(ndp[i][j], dp[i][j]);
if (i + a <= x && j + b <= y) ndp[i + a][j + b] = max(ndp[i + a][j + b], dp[i][j] + c);
}
swap(dp, ndp);
}
ll ans = -INF;
rep(i, x + 1) rep(j, y + 1) ans = max(ans, dp[i][j]);
cout << ans << '\n';
return 0;
}
a01sa01to