結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-04-27 14:42:35
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 816,852 KB
最終ジャッジ日時 2023-09-26 08:00:06
合計ジャッジ時間 18,617 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,100 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 89 ms
15,428 KB
testcase_06 WA -
testcase_07 AC 76 ms
15,048 KB
testcase_08 AC 1,411 ms
32,128 KB
testcase_09 RE -
testcase_10 AC 446 ms
19,500 KB
testcase_11 AC 82 ms
15,028 KB
testcase_12 AC 88 ms
15,268 KB
testcase_13 AC 683 ms
22,880 KB
testcase_14 AC 661 ms
22,656 KB
testcase_15 AC 80 ms
14,940 KB
testcase_16 WA -
testcase_17 AC 334 ms
18,228 KB
testcase_18 AC 667 ms
22,372 KB
testcase_19 AC 750 ms
23,232 KB
testcase_20 AC 76 ms
15,168 KB
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 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 MLE -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

mod = 998244353
N = gets.to_i
A = Array.new(3)
B = Array.new(3)
(0..2).each do |i|
  A[i], B[i] = gets.split.map(&:to_i)
end
N2 = A[0]*A[1]*A[2]*3
ans = [B[0]*A[1]*A[2],A[0]*B[1]*A[2],A[0]*A[1]*B[2]].max * 3 * N.div(N2) % mod

dp = Array.new(N2+1, 0)

(0..N2).each do |i|
  (0..2).each do |j|
    dp[i+A[j]] = [dp[i+A[j]], dp[i]+B[j]].max if i+A[j] <= N2
  end
end
puts (ans+dp[N%N2])%mod
0