#include #define FastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; void solve() { int n, m; string s; cin >> n >> m >> s; vector> cells(n + 1, vector(n + 1, 1)); int x = 0, y = n; cells[y][x] = 0; for (const auto c : s) { if (c == 'U') { y--; } else if (c == 'R') { x++; } else if (c == 'L') { x--; } else { y++; } cells[y][x] = 0; } rep(i, n + 1) rep(j, n + 1) cout << cells[i][j] << (j != n ? ' ' : '\n'); } int main() { FastIO; solve(); return 0; }