結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-04-26 15:00:34
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 625,504 KB
最終ジャッジ日時 2023-09-26 07:59:31
合計ジャッジ時間 13,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,236 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 81 ms
15,088 KB
testcase_06 WA -
testcase_07 AC 77 ms
15,248 KB
testcase_08 AC 516 ms
20,552 KB
testcase_09 RE -
testcase_10 AC 201 ms
16,840 KB
testcase_11 AC 82 ms
15,164 KB
testcase_12 AC 83 ms
15,020 KB
testcase_13 AC 279 ms
17,648 KB
testcase_14 AC 277 ms
17,508 KB
testcase_15 AC 80 ms
15,064 KB
testcase_16 WA -
testcase_17 AC 167 ms
16,096 KB
testcase_18 AC 271 ms
17,312 KB
testcase_19 AC 294 ms
17,820 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 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]
ans = [B[0]*A[1]*A[2],A[0]*B[1]*A[2],A[0]*A[1]*B[2]].max * 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