結果

問題 No.179 塗り分け
ユーザー 👑 obakyanobakyan
提出日時 2019-05-05 22:56:40
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-08 12:21:55
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 4 ms
4,384 KB
testcase_07 WA -
testcase_08 AC 49 ms
4,384 KB
testcase_09 WA -
testcase_10 AC 41 ms
4,380 KB
testcase_11 AC 31 ms
4,384 KB
testcase_12 AC 39 ms
4,384 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 39 ms
4,384 KB
testcase_19 AC 36 ms
4,380 KB
testcase_20 AC 38 ms
4,384 KB
testcase_21 AC 42 ms
4,380 KB
testcase_22 AC 46 ms
4,380 KB
testcase_23 AC 39 ms
4,384 KB
testcase_24 AC 77 ms
4,384 KB
testcase_25 AC 43 ms
4,384 KB
testcase_26 WA -
testcase_27 AC 38 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 38 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 37 ms
4,380 KB
testcase_32 AC 40 ms
4,380 KB
testcase_33 AC 40 ms
4,384 KB
testcase_34 WA -
testcase_35 AC 39 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 3 ms
4,384 KB
testcase_44 AC 6 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ior = io.input()
local h, w = ior:read("*n", "*n", "*l")
local t = {}
local str = ""
for i = 1, h do
  str = ior:read()
  for j = 1, w do
    t[j + (i - 1) * w] = str:sub(j, j) == "#" and 1 or 0
  end
end

local function check(hdiff, wdiff)
  local tbl = {unpack(t)}
  local ret = true
  for i_h = 1, h do for j_w = 1, w do
    local idx = j_w + (i_h - 1) * w
    if(tbl[idx] == 1) then
      if(h < i_h + hdiff or w < j_w + wdiff) then
        ret = false break
      end
      local dst = idx + w * hdiff + wdiff
      if(tbl[dst] ~= 1) then
        ret = false break
      end
      tbl[dst] = 2
    end
  end end
  return ret
end

local isok = false
for i = 0, h - 1 do for j = 0, w - 1 do
  if(i ~= 0 or j ~= 0) then
    if(check(i, j)) then
      isok = true
      break
    end
  end
end end
print(isok and "YES" or "NO")
0