結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2023-06-27 03:56:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 883 bytes
コンパイル時間 6,233 ms
コンパイル使用メモリ 259,004 KB
実行使用メモリ 814,520 KB
最終ジャッジ日時 2023-09-26 08:02:05
合計ジャッジ時間 10,589 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 21 ms
25,036 KB
testcase_04 AC 16 ms
20,028 KB
testcase_05 RE -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 RE -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 6 ms
6,116 KB
testcase_18 AC 8 ms
10,348 KB
testcase_19 AC 6 ms
7,472 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 22 ms
25,684 KB
testcase_23 AC 22 ms
25,624 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 MLE -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

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; cin >> n;
  vll a(3), b(3); rep(i, 3) cin >> a[i] >> b[i];
  ll k = lcm(a[0], lcm(a[1], a[2]));
  ll k3 = k * 3;

  vll dp(k3 + 110);  //dp[うどん札の枚数] = 割引額の最大
  rep(i, k3) {
    rep(j, 3) {
      dp[i+a[j]] = max(dp[i+a[j]], dp[i] + b[j]);
    }
  }

  ll mlt = max(0LL, (n / k) - 2) ;
  ll dpk = dp[k];
  cout << (n >= k3 ? dpk * mlt + dp[n%k + 2*k] : dp[n]) << endl;

}
0