#include #include #include #include #include #define ll long long using namespace std; int n,m, ans; char c; vector table; void draw(char c, int x, int y1, int y2) { if (y1 < 0) y1 = 0; if (y2 >= n) y2 = n; for(int i = y1; i < y2; i++) { table[i+1][x+1] = c; } } int main() { ios::sync_with_stdio(false); cout << setprecision(10); while(scanf("%d %d",&n,&m) != -1) { //init table = vector(n+2); table[0] = string(n+2,'*'); table[n+1] = string(n+2,'*'); for(int i = 1; i <= n; i++) { table[i] = '*' + string(n,'.') + '*'; } //alg for(int i = 0; i < m; i++) { int s,x,y; scanf("%d %d %d", &s, &x, &y); if (y >= 0 && y < n && x >=1 && x<=n) table[y+1][x]='_'; if (y >= 0 && y < n && x >=-1 && x<=n-2) table[y+1][x+2]='_'; if (s == 0) { if (y >= 0 && y < n && x >=0 && x=-1 && x<=n-2) draw('\\',x+1, y+1, y+s+1); if (x>=1 && x<=n) draw('/',x-1, y+1, y+s+1); if (x>=0 && x<=n-1) draw('|',x, y, y+s+1); if (x>=0 && x<=n-1 && y+s+1 >= 0 && y+s+1 < n) table[y+s+2][x+1] = '^'; } } for(int i = n+1;i >= 0; i--) printf("%s\n", table[i].c_str()); printf("\n"); } return 0; }