#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int main() { int n, m; cin >> n >> m; string s; cin >> s; vector> grid(n + 1, vector(n + 1, 1)); grid[n][0] = 0; int x = 0, y = n; for (int i = 0; i < m; i++) { if (s[i] == 'U') y--; if (s[i] == 'D') y++; if (s[i] == 'R') x++; if (s[i] == 'L') x--; grid[y][x] = 0; } for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) cout << grid[i][j] << " \n"[j == n]; } return 0; }