結果
| 問題 |
No.2317 Expression Menu
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-26 21:29:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 624 bytes |
| コンパイル時間 | 1,972 ms |
| コンパイル使用メモリ | 167,252 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 04:58:35 |
| 合計ジャッジ時間 | 3,330 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, x, y, a, b, c;
cin >> n >> x >> y;
ll dp[x + 1][y + 1] = {};
ll ans = 0;
for(int i = 0; i < n; i++){
cin >> a >> b >> c;
for(int j = x - a; j >= 0; j--){
for(int k = y - b; k >= 0; k--){
dp[j + a][k + b] = max(dp[j + a][k + b], dp[j][k] + c);
}
}
}
for(int i = 0; i <= x; i++){
for(int j = 0; j <= y; j++){
ans = max(ans, dp[i][j]);
}
}
cout << ans << '\n';
}