#include #include #include using namespace std; int main(){ int n, m; cin >> n >> m; string s; cin >> s; vector> a(n + 1, vector(n + 1, 1)); a[0][0] = 0; int y = 0, x = 0; for (int i = 0; i < m; i++){ if (s[i] == 'U'){ y++; } if (s[i] == 'R'){ x++; } if (s[i] == 'L'){ x--; } if (s[i] == 'D'){ y--; } a[y][x] = 0; } for (int i = n; i >= 0; i--){ for (int j = 0; j <= n; j++){ cout << a[i][j]; if (j < n){ cout << ' '; } } cout << endl; } }