結果

問題 No.555 世界史のレポート
ユーザー 👑 obakyanobakyan
提出日時 2019-05-06 13:34:11
言語 Lua
(LuaJit 2.1.1696795921)
結果
MLE  
実行時間 -
コード長 627 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 812,944 KB
最終ジャッジ日時 2023-09-09 21:46:32
合計ジャッジ時間 2,672 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 7 ms
6,172 KB
testcase_06 AC 6 ms
6,208 KB
testcase_07 AC 11 ms
10,356 KB
testcase_08 AC 11 ms
10,544 KB
testcase_09 AC 11 ms
10,264 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0