結果

問題 No.2390 Udon Coupon (Hard)
ユーザー achapiachapi
提出日時 2023-07-21 23:02:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 205,008 KB
実行使用メモリ 814,200 KB
最終ジャッジ日時 2023-10-21 23:04:30
合計ジャッジ時間 6,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 8 ms
10,576 KB
testcase_04 AC 5 ms
8,992 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 5 ms
6,684 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 4 ms
5,696 KB
testcase_19 AC 3 ms
4,640 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
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 MLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
}
0