結果

問題 No.2317 Expression Menu
ユーザー GlinTFrauleinGlinTFraulein
提出日時 2023-05-26 22:35:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,270 bytes
コンパイル時間 4,249 ms
コンパイル使用メモリ 262,340 KB
実行使用メモリ 370,576 KB
最終ジャッジ日時 2023-08-26 12:41:59
合計ジャッジ時間 19,391 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
9,120 KB
testcase_01 AC 7 ms
9,064 KB
testcase_02 AC 31 ms
29,756 KB
testcase_03 AC 422 ms
370,252 KB
testcase_04 AC 408 ms
370,312 KB
testcase_05 AC 406 ms
370,308 KB
testcase_06 AC 404 ms
370,388 KB
testcase_07 AC 412 ms
370,216 KB
testcase_08 WA -
testcase_09 AC 407 ms
370,260 KB
testcase_10 AC 410 ms
370,272 KB
testcase_11 AC 406 ms
370,260 KB
testcase_12 AC 406 ms
370,312 KB
testcase_13 AC 405 ms
370,308 KB
testcase_14 AC 406 ms
370,376 KB
testcase_15 AC 405 ms
370,384 KB
testcase_16 AC 405 ms
370,576 KB
testcase_17 AC 402 ms
370,296 KB
testcase_18 AC 404 ms
370,356 KB
testcase_19 AC 402 ms
370,308 KB
testcase_20 AC 403 ms
370,256 KB
testcase_21 AC 408 ms
370,216 KB
testcase_22 AC 408 ms
370,388 KB
testcase_23 AC 415 ms
370,392 KB
testcase_24 AC 414 ms
370,268 KB
testcase_25 AC 413 ms
370,312 KB
testcase_26 AC 411 ms
370,272 KB
testcase_27 AC 414 ms
370,220 KB
testcase_28 AC 412 ms
370,312 KB
testcase_29 AC 413 ms
370,292 KB
testcase_30 AC 415 ms
370,220 KB
testcase_31 AC 411 ms
370,548 KB
testcase_32 AC 416 ms
370,304 KB
testcase_33 AC 5 ms
6,780 KB
testcase_34 AC 5 ms
6,740 KB
testcase_35 AC 5 ms
6,732 KB
testcase_36 AC 5 ms
6,732 KB
testcase_37 AC 5 ms
6,688 KB
testcase_38 AC 413 ms
370,376 KB
testcase_39 AC 412 ms
370,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
 
#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep3(i, n, k) for (ll i = k; i < n; i++)
#define all(a) a.begin(), a.end()
#define YNeos(bool) (bool ? "Yes" : "No")
 
using namespace std;
using namespace atcoder;
const ll INF = 1LL << 60;
const ll mod = 998244353;
const double pi = acos(-1);

int main() {
  ll n, x, y; cin >> n >> x >> y;
  vll a(n), b(n), c(n); rep(i, n) cin >> a[i] >> b[i] >> c[i];

  const ll xpr = 500;

  vec<vll> dp(n+1, vll(155310));  //dp[i番目の機能まで見た][消費したメニュー枠*1000+消費した容量]=上げたかわいさの最大値
  dp[0][0] = 0;
  if ((a[0] <= x) && (b[0] <= y)) dp[0][a[0]*xpr + b[0]] = c[0];

  rep(i, n) {
    ll abadd = a[i]*xpr+b[i];
    rep(j, x) {
      rep(k, y) {
        ll itr = j*xpr+k;
        dp[i+1][itr] = max(dp[i][itr], dp[i+1][itr]);
        if (((itr/xpr + abadd/xpr) <= x) && ((itr%xpr + abadd%xpr) <= y)) dp[i+1][itr+abadd] = max(dp[i][itr]+c[i], dp[i+1][itr+abadd]);
      }
    }
  }

  ll ans = 0;
  rep(i, n+1) {
    rep(j, 155310) {
      ans = max(dp[i][j], ans);
    }
  }

  cout << ans << endl;
}
0