/* -*- coding: utf-8 -*- * * 1133.cc: No.1133 キムワイプイーター - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200; const int MAX_M = 1000000; /* typedef */ /* global variables */ char s[MAX_M + 4]; int fs[MAX_N + 1][MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, m; scanf("%d%d%s", &n, &m, s); fs[0][0] = 1; int x = 0, y = 0; for (int i = 0; i < m; i++) { switch (s[i]) { case 'U': y++; break; case 'R': x++; break; case 'L': x--; break; case 'D': y--; break; } fs[y][x] = 1; } for (int y = n; y >= 0; y--) for (int x = 0; x <= n; x++) { printf("%d", fs[y][x] ^ 1); putchar(x < n ? ' ' : '\n'); } return 0; }