結果

問題 No.2317 Expression Menu
ユーザー GlinTFrauleinGlinTFraulein
提出日時 2023-05-26 22:30:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,264 bytes
コンパイル時間 4,268 ms
コンパイル使用メモリ 263,044 KB
実行使用メモリ 370,600 KB
最終ジャッジ日時 2023-08-26 12:33:57
合計ジャッジ時間 18,233 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
9,144 KB
testcase_01 AC 6 ms
9,148 KB
testcase_02 AC 27 ms
29,776 KB
testcase_03 AC 426 ms
370,372 KB
testcase_04 AC 403 ms
370,372 KB
testcase_05 AC 385 ms
370,296 KB
testcase_06 AC 370 ms
370,320 KB
testcase_07 AC 372 ms
370,428 KB
testcase_08 WA -
testcase_09 AC 377 ms
370,252 KB
testcase_10 AC 384 ms
370,236 KB
testcase_11 AC 386 ms
370,312 KB
testcase_12 AC 383 ms
370,372 KB
testcase_13 AC 374 ms
370,444 KB
testcase_14 AC 373 ms
370,288 KB
testcase_15 AC 380 ms
370,408 KB
testcase_16 AC 370 ms
370,440 KB
testcase_17 AC 372 ms
370,372 KB
testcase_18 AC 376 ms
370,260 KB
testcase_19 AC 378 ms
370,600 KB
testcase_20 AC 377 ms
370,300 KB
testcase_21 AC 377 ms
370,316 KB
testcase_22 AC 373 ms
370,300 KB
testcase_23 AC 381 ms
370,440 KB
testcase_24 AC 374 ms
370,300 KB
testcase_25 AC 373 ms
370,428 KB
testcase_26 AC 375 ms
370,308 KB
testcase_27 AC 379 ms
370,300 KB
testcase_28 AC 372 ms
370,260 KB
testcase_29 AC 377 ms
370,324 KB
testcase_30 AC 383 ms
370,376 KB
testcase_31 AC 383 ms
370,376 KB
testcase_32 AC 383 ms
370,292 KB
testcase_33 AC 4 ms
6,748 KB
testcase_34 AC 4 ms
6,732 KB
testcase_35 AC 4 ms
6,732 KB
testcase_36 AC 4 ms
6,720 KB
testcase_37 AC 3 ms
6,716 KB
testcase_38 AC 376 ms
370,280 KB
testcase_39 AC 379 ms
370,248 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;
  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, x+1) {
      rep(k, y+1) {
        ans = max(dp[i][j*xpr+k], ans);
      }
    }

  }

  cout << ans << endl;
}
0