結果

問題 No.1133 キムワイプイーター
ユーザー 👑 obakyanobakyan
提出日時 2020-08-11 16:59:02
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 17:27:18
合計ジャッジ時間 1,475 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 9 ms
6,944 KB
testcase_03 AC 18 ms
6,940 KB
testcase_04 AC 18 ms
6,940 KB
testcase_05 AC 18 ms
6,944 KB
testcase_06 AC 17 ms
6,940 KB
testcase_07 AC 13 ms
6,940 KB
testcase_08 AC 9 ms
6,940 KB
testcase_09 AC 15 ms
6,940 KB
testcase_10 AC 23 ms
6,944 KB
testcase_11 AC 21 ms
6,940 KB
testcase_12 AC 18 ms
6,944 KB
testcase_13 AC 21 ms
6,940 KB
testcase_14 AC 13 ms
6,940 KB
testcase_15 AC 11 ms
6,944 KB
testcase_16 AC 9 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 5 ms
6,940 KB
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 4 ms
6,940 KB
testcase_22 AC 5 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 3 ms
6,944 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 1 ms
6,944 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 4 ms
6,944 KB
testcase_31 AC 1 ms
6,944 KB
testcase_32 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, m = io.read("*n", "*n", "*l")
local s = io.read()
local t = {}
for i = 1, (n + 1) * (n + 1) do
  t[i] = 1
end
t[1] = 0
local byte_u = string.byte("U")
local byte_d = string.byte("D")
local byte_r = string.byte("R")
local curpos = 0
local x, y = 1, 1
for irep = 1, m do
  local b = s:byte(irep)
  if b == byte_u then
    y = y + 1
  elseif b == byte_d then
    y = y - 1
  elseif b == byte_r then
    x = x + 1
  else
    x = x - 1
  end
  local idx = (x - 1) * (n + 1) + y
  t[idx] = 0
end
for y = n + 1, 1, -1 do
  for x = 1, n + 1 do
    local idx = (x - 1) * (n + 1) + y
    io.write(t[idx])
    io.write(x == n + 1 and "\n" or " ")
  end
end
0