結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-07-03 11:43:51
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 494 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 11,392 KB
実行使用メモリ 76,332 KB
最終ジャッジ日時 2023-09-26 08:05:21
合計ジャッジ時間 23,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
19,476 KB
testcase_01 AC 82 ms
15,188 KB
testcase_02 AC 90 ms
15,204 KB
testcase_03 AC 90 ms
15,488 KB
testcase_04 AC 89 ms
15,012 KB
testcase_05 AC 87 ms
14,948 KB
testcase_06 AC 82 ms
15,000 KB
testcase_07 AC 83 ms
15,172 KB
testcase_08 AC 91 ms
15,316 KB
testcase_09 TLE -
testcase_10 AC 84 ms
15,228 KB
testcase_11 AC 82 ms
15,056 KB
testcase_12 AC 82 ms
15,280 KB
testcase_13 AC 87 ms
15,000 KB
testcase_14 AC 85 ms
15,188 KB
testcase_15 AC 81 ms
14,988 KB
testcase_16 AC 82 ms
15,176 KB
testcase_17 AC 84 ms
15,264 KB
testcase_18 AC 86 ms
15,016 KB
testcase_19 AC 86 ms
15,248 KB
testcase_20 AC 83 ms
15,232 KB
testcase_21 AC 83 ms
15,012 KB
testcase_22 AC 93 ms
15,268 KB
testcase_23 AC 93 ms
15,436 KB
testcase_24 AC 810 ms
26,628 KB
testcase_25 AC 849 ms
27,428 KB
testcase_26 AC 849 ms
27,136 KB
testcase_27 AC 853 ms
27,632 KB
testcase_28 AC 784 ms
26,092 KB
testcase_29 TLE -
testcase_30 AC 1,790 ms
42,616 KB
testcase_31 AC 1,997 ms
45,896 KB
testcase_32 TLE -
testcase_33 AC 1,947 ms
44,924 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
if A[1]*B[2] < A[2]*B[1] then
    A[2],B[2],A[1],B[1]=A[1],B[1],A[2],B[2]
end
if A[0]*B[2] < A[2]*B[0] then
    A[0],B[0],A[2],B[2]=A[2],B[2],A[0],B[0]	
end

dp = Array.new((A[2]+1)*(A[1]+A[0]), 0)
ans=0
(0..(A[2]*(A[0]+A[1]))).each do |i|
    ans=[ans,dp[i]+(N-i)/A[2]*B[2]].max if N>=i
    (0..1).each do |j|
        dp[i+A[j]] = [dp[i+A[j]], dp[i]+B[j]].max
    end
end
puts (ans)
0