#include #include #include using namespace std; void drawTheShit(int x, int y,char ** pole,int m,char c){ if(x < 0 || x > m-1 || y < 0 || y > m-1) return; pole[x][y] = c; } void printTheForest(char ** pole, int m){ // *** for(int i = 0; i < m+2; i++){ cout << '*'; } cout << endl; for(int i = 0; i < m; i++){ cout << '*'; for(int j = 0; j < m; j++){ cout << pole[i][j]; } cout << '*' << endl; } for(int i = 0; i < m+2; i++){ cout << '*'; } cout << endl; } int main(int argc, char** argv) { std::ios::sync_with_stdio(false); int m,n; while(cin >> m >> n){ char ** pole = new char*[m]; for(int i = 0; i < m; i ++){ pole[i] = new char[m]; memset(pole[i],46,m); } for(int lines = 0; lines < n; lines++){ int s,x,y; cin >> s >> x >> y; if(s == 0){ drawTheShit((m-1)-y,x-1,pole,m,95); drawTheShit((m-1)-y,x,pole,m,111); drawTheShit((m-1)-y,x+1,pole,m,95); } else{ // drawing trunk drawTheShit((m-1)-y,x-1,pole,m,95); drawTheShit((m-1)-y,x,pole,m,124); drawTheShit((m-1)-y,x+1,pole,m,95); // tree for(int height = 1; height <= s; height++){ drawTheShit((m-1)-y-height,x-1,pole,m,47); drawTheShit((m-1)-y-height,x,pole,m,124); drawTheShit((m-1)-y-height,x+1,pole,m,92); } drawTheShit((m-1)-s-y-1,x,pole,m,94); } } printTheForest(pole,m); } return 0; }