結果
| 問題 | No.77 レンガのピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-06 10:57:55 |
| 言語 | Lua (LuaJit 2.1.1791890110) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 478µs | |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 9,908 KB |
| 実行使用メモリ | 9,860 KB |
| 最終ジャッジ日時 | 2026-10-13 03:58:04 |
| 合計ジャッジ時間 | 1,864 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 21 |
ソースコード
local n = io.read("*n")
local tot = 0
local a = {}
for i = 1, n do
local tmp = io.read("*n")
tot, a[i] = tot + tmp, tmp
end
local minmvcnt = 10000
for i = 1, 100 do
if(tot < i * i) then break end
local mvcnt = 0
-- check only MINUS count
for j = 1, n do
local tgt = 0
if(j <= i) then tgt = j
elseif(j < 2 * i) then tgt = 2 * i - j
end
mvcnt = mvcnt + math.max(0, a[j] - tgt)
end
minmvcnt = math.min(minmvcnt, mvcnt)
end
print(minmvcnt)