結果
問題 |
No.555 世界史のレポート
|
ユーザー |
👑 |
提出日時 | 2019-05-06 13:34:11 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
MLE
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 47 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 817,152 KB |
最終ジャッジ日時 | 2024-06-27 14:17:11 |
合計ジャッジ時間 | 2,869 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 MLE * 1 -- * 9 |
ソースコード
local n, c, v = io.read("*n", "*n", "*n") local t = {} local inf = (c + v) * n for i = 1, n * n do t[i] = inf end t[1] = c local mmi = math.min for i_n = 1, n - 1 do for i_cp = 1, i_n do local src_idx = i_cp + (i_n - 1) * n local paste_dst_n = mmi(n, i_n + i_cp) local paste_dst_idx = i_cp + (paste_dst_n - 1) * n t[paste_dst_idx] = mmi(t[paste_dst_idx], t[src_idx] + v) local copy_dst_idx = i_n + (i_n - 1) * n t[copy_dst_idx] = mmi(t[copy_dst_idx], t[src_idx] + c) end end local minval = inf for i_cp = 1, n - 1 do local idx = i_cp + (n - 1) * n minval = mmi(minval, t[idx]) end print(minval)