Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- #include <string>
- #include <algorithm>
- #include <set>
- using namespace ::std;
- struct pos
- {
- int x, y;
- };
- bool operator<(pos p1, pos p2)
- {
- if (p1.x == p2.x)
- return p1.y < p2.y;
- else
- return p1.x < p2.x;
- }
- int main()
- {
- int maxx=0, maxy=0, minx=0, miny=0, n;
- set <pos> kil;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- int x, y;
- pos prom;
- cin >> x >> y;
- prom.x = x;
- prom.y = y;
- kil.insert(prom);
- if (x > maxx)
- maxx = x;
- if (x < minx)
- minx = x;
- if (y > maxy)
- maxy = y;
- if (y < miny)
- miny= y;
- }
- for (int y = maxy; y >= miny; y--)
- {
- for (int x = minx; x <= maxx; x++)
- {
- pos prom;
- prom.x = x;
- prom.y = y;
- if (kil.find(prom) != kil.end())
- cout << "*";
- else
- if (x == 0 && y != 0)
- cout << "|";
- else
- if (x != 0 && y == 0)
- cout << "-";
- else
- if (y == 0 && x == 0)
- cout << "+";
- else
- cout << ".";
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment