結果
問題 | No.2317 Expression Menu |
ユーザー |
![]() |
提出日時 | 2023-03-15 00:39:34 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 1,035 ms |
コンパイル使用メモリ | 89,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-18 09:38:29 |
合計ジャッジ時間 | 2,665 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <climits>#include <iostream>#include <vector>using namespace std;using ll = long long;const ll INF = LLONG_MAX / 4;void chmax(ll& a, ll b) { if(a < b) a = b; }int main() {int N, X, Y;cin >> N >> X >> Y;vector dp(X + 1, vector(Y + 1, 0LL));dp[0][0] = 0;while(N--) {int A, B, C;cin >> A >> B >> C;for(int x = X; x >= A; x--) for(int y = Y; y >= B; y--) {chmax(dp[x][y], dp[x - A][y - B] + C);}}cout << dp[X][Y] << endl;}