結果
問題 |
No.1133 キムワイプイーター
|
ユーザー |
👑 |
提出日時 | 2020-08-11 16:59:02 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 7,072 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 11:34:43 |
合計ジャッジ時間 | 1,684 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
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