結果
問題 | No.472 平均順位 |
ユーザー |
👑 |
提出日時 | 2019-05-02 11:09:05 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 13:15:00 |
合計ジャッジ時間 | 1,629 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
local ior = io.input()local n, p = ior:read("*n", "*n")local t = {}for i = 1, p + 5 do t[i] = 0 endt[1] = 0local curmax = 1for i_n = 1, n dolocal a, b, c = ior:read("*n", "*n", "*n")t[curmax], t[curmax + 1], t[curmax + 2], t[curmax + 3]= t[curmax] + a, t[curmax] + b, t[curmax] + c, t[curmax] + 1for i = curmax - 1, 1, -1 dot[i + 3] = math.min(t[i + 3], t[i] + 1)t[i + 2] = math.min(t[i + 2], t[i] + c)t[i + 1] = math.min(t[i + 1], t[i] + b)t[i] = t[i] + aendcurmax = math.min(p + 1, 3 * i_n + 1)endprint(string.format("%.8f", t[p + 1] / n))