#include #include using namespace std; void draw_roots(int s, int x, int y, int m, vector< vector > *img){ if (y >= 0 && y <= m-1){ (*img)[x+1][y] = 95; (*img)[x+3][y] = 95; if (s > 0){ (*img)[x+2][y] = 124; } else{ (*img)[x+2][y] = 111; } } } void draw_top(int x, int top, int m, vector< vector > *img){ if (top >= 0 && top <= m-1){ (*img)[x+2][top] = 94; } } int main(int argc, char** argv) { int num_trees, m; ios::sync_with_stdio(false); while (cin >> m){ cin >> num_trees; vector< vector > img(m + 4, vector(m, '.')); int s, x, y, top, bottom; for (int i = 0; i < num_trees; i++){ cin >> s >> x >> y; bottom = max(y, 0); top = y+1+s; for (int j = bottom; j < top && j < m; j++){ img[x+2][j] = 124; img[x+3][j] = 92; img[x+1][j] = 47; } if (y >= 0){ draw_roots(s, x, bottom, m, &img); } if (top < m && s != 0){ draw_top(x, top, m, &img); } } for (int i = 0; i < m+2; i++){ cout << "*"; } cout << endl; for (int j = m-1; j >= 0; j--){ cout << "*"; for (int i = 2; i < m+2; i++){ cout << img[i][j]; } cout << "*"; cout << endl; } for (int i = 0; i < m+2; i++){ cout << "*"; } cout << endl; cout << endl; } return 0; }