結果
| 問題 |
No.2390 Udon Coupon (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-21 23:02:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 453 bytes |
| コンパイル時間 | 1,626 ms |
| コンパイル使用メモリ | 196,668 KB |
| 最終ジャッジ日時 | 2025-02-15 17:27:15 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 4 RE * 15 MLE * 1 -- * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
cin >> N;
vector<int> A(3), B(3);
for (int i = 0; i < 3; i++){
cin >> A[i] >> B[i];
}
int l = lcm(lcm(A[0], A[1]), A[2]);
vector<long long> dp(l + 1);
for (int i = 0; i <= l; i++){
for (int j = 0; j < 3; j++){
if (i + A[j] <= l){
dp[i + A[j]] = max(dp[i + A[j]], dp[i] + B[j]);
}
}
}
long long ans = dp[l] * (N / l) + dp[(N % l)];
cout << ans << '\n';
}