結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,228 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 78 ms
15,096 KB
testcase_06 WA -
testcase_07 AC 79 ms
15,168 KB
testcase_08 AC 78 ms
14,972 KB
testcase_09 RE -
testcase_10 AC 141 ms
15,856 KB
testcase_11 AC 85 ms
15,056 KB
testcase_12 AC 89 ms
15,484 KB
testcase_13 AC 101 ms
15,252 KB
testcase_14 AC 143 ms
15,844 KB
testcase_15 AC 77 ms
15,232 KB
testcase_16 WA -
testcase_17 AC 80 ms
15,012 KB
testcase_18 AC 110 ms
15,548 KB
testcase_19 AC 108 ms
15,724 KB
testcase_20 AC 74 ms
15,064 KB
testcase_21 AC 75 ms
14,996 KB
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 TLE -
testcase_40 MLE -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
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]
loop = [0,N.div(N2)-2].max
ans = [B[0]*A[1]*A[2],A[0]*B[1]*A[2],A[0]*A[1]*B[2]].max * loop
N -= loop * N2

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

(0..N).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] <= N
  end
end
puts (ans+dp[N])%mod
0