結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2019-05-05 10:37:03 | 
| 言語 | Lua  (LuaJit 2.1.1734355927)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 436 ms / 2,000 ms | 
| コード長 | 592 bytes | 
| コンパイル時間 | 156 ms | 
| コンパイル使用メモリ | 6,944 KB | 
| 実行使用メモリ | 20,708 KB | 
| 最終ジャッジ日時 | 2024-06-24 09:48:08 | 
| 合計ジャッジ時間 | 6,374 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 17 | 
ソースコード
local ior = io.input()
local h, w, n = ior:read("*n", "*n", "*n", "*l")
local way, pos = {}, {}
local str = ""
for i = 1, n do
  str = ior:read()
  local a, b = str:match("(%w) (%d+)")
  way[i], pos[i] = a, tonumber(b)
end
local curcol, currow = 0, 0
for i = n, 1, -1 do
  if(way[i] == "C") then
    if(curcol == pos[i]) then
      currow = currow - 1
      if(currow == -1) then currow = h - 1 end
    end
  else
    if(currow == pos[i]) then
      curcol = curcol - 1
      if(curcol == -1) then curcol = w - 1 end
    end
  end
end
print((curcol + currow) % 2 == 1 and "black" or "white")