結果

問題 No.472 平均順位
ユーザー masashi0217masashi0217
提出日時 2021-04-03 11:40:55
言語 Ruby
(3.2.2)
結果
TLE  
実行時間 -
コード長 535 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 11,468 KB
実行使用メモリ 15,304 KB
最終ジャッジ日時 2023-08-26 01:51:22
合計ジャッジ時間 8,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,300 KB
testcase_01 AC 82 ms
15,164 KB
testcase_02 AC 80 ms
15,116 KB
testcase_03 AC 80 ms
15,108 KB
testcase_04 AC 98 ms
15,132 KB
testcase_05 AC 83 ms
15,304 KB
testcase_06 AC 85 ms
15,120 KB
testcase_07 AC 103 ms
15,112 KB
testcase_08 AC 319 ms
15,140 KB
testcase_09 AC 1,408 ms
15,256 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, pp = gets.chomp.split(" ").map(&:to_i)
INF = Float::INFINITY
dp = Array.new(2).map{Array.new((n * 3)+4,INF)}
dp[0][0] = 0
max = 0
n.times do |i|
    a, b, c = gets.chomp.split(" ").map(&:to_i)
    d = 1
    rank = [a,b,c,d]
    max += 3
    0.upto(max) do |j|
        0.upto(3) do |k|
            #p [dp[1][j+k],dp[0][j+k]+rank[k]].min

            dp[1][j+k] = [dp[1][j+k],dp[0][j]+rank[k]].min
        end
    end
    0.upto(max) do |xy|
        dp[0][xy] = dp[1][xy]
        dp[1][xy] = INF
    end
end
puts ((dp[0])[pp])/n.to_f
0