#include #include #include #include #include using namespace std; struct Suradnice { public: int S_; int X_; int Y_; }; int main() { ios_base::sync_with_stdio(false); char les[100][100]; int rozmer; int pocetNacitanychSuradnic; vector suradnice; suradnice.resize(100000); Suradnice* pom; int s; int x; int y; while (cin >> rozmer >> pocetNacitanychSuradnic) { string hviezdy(rozmer + 2, '*'); for (int i = 0; i < rozmer; i++) { for (int j = 0; j < rozmer; j++) { les[i][j] = '.'; } } for (int i = 0; i < pocetNacitanychSuradnic; i++) { cin >> suradnice[i].S_; cin >> suradnice[i].X_; cin >> suradnice[i].Y_; } for (int i = 0; i < pocetNacitanychSuradnic; i++) { pom = &suradnice[i]; s = pom->S_; x = pom->X_; y = rozmer - 1 - pom->Y_; if (pom->S_ == 0) { if ( (x - 1) >= 0 && (x-1) < rozmer && y >= 0 && y < rozmer) { les[y][x -1] = '_'; } if (x >= 0 && x < rozmer && y >= 0 && y < rozmer) { les[y][x] = 'o'; } if ((x + 1) >= 0 && (x + 1) < rozmer && y >= 0 && y < rozmer) { les[y][x + 1] = '_'; } } else { if (x >= 0 && x < rozmer && (y - s - 1) >= 0 && (y - s - 1) < rozmer ) { les[y - s - 1][x] = '^'; } if (x >= 0 && x < rozmer) { for (int i = 1; i <= s; i++) { if ( (y - i) >= 0 && (y - i) < rozmer) { les[y - i][x] = '|'; } } } if ((x - 1) >= 0 && (x - 1) < rozmer) { for (int i = 1; i <= s; i++) { if ((y - i) >= 0 && (y - i) < rozmer) { les[y - i][x - 1] = 47; } } } if ((x + 1) >= 0 && (x + 1) < rozmer) { for (int i = 1; i <= s; i++) { if ((y - i) >= 0 && (y - i) < rozmer) { les[y - i][x + 1] = 92; } } } if ((x - 1) >= 0 && (x - 1) < rozmer && y >= 0 && y < rozmer) { les[y][x -1] = '_'; } if (x >= 0 && x < rozmer && y >= 0 && y < rozmer) { les[y][x] = '|'; } if ((x + 1) >= 0 && (x + 1) < rozmer && y >= 0 && y < rozmer) { les[y][x + 1] = '_'; } } } cout << hviezdy << "\n"; for (int i = 0; i < rozmer; i++) { cout << "*"; for (int j = 0; j < rozmer; j++) { cout << les[i][j]; } cout << "*\n"; } cout << hviezdy << "\n"; } return 0; }