#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n, m; cin >> n >> m; n++; string s; cin >> s; vector Grid(n, vector(n, true)); Grid[n - 1][0] = false; int i = n - 1, j = 0; for (char c : s) { if (c == 'U') i--; if (c == 'D') i++; if (c == 'L') j--; if (c == 'R') j++; Grid[i][j] = false; } rep(i, n) { rep(j, n) cout << (Grid[i][j] ? 1 : 0) << " "; cout << endl; } return 0; }