#include #include #include #include #include using namespace std; struct point { int x, y; bool makrx, makry; point(): makrx(false), makry(false){} point(int _x, int _y): makrx(false), makry(false), x(_x), y(_y){} bool operator < (const point & b) const { if(y == b.y) return x < b.x; return y < b.y; } bool operator == (const point &b) const { if(x == b.x && y == b.y) return true; return false; } }; struct edge { point a, b; edge(point _a, point _b) { a = _a; b = _b; } bool operator < (const edge &B) const { if(a == B.a) return b < B.b; return a < B.a; } }; long long int det(point a, point b, point c) { return a.x*(b.y-c.y)-a.y*(b.x-c.x)+b.x*c.y-b.y*c.x; } int fun() { int n; scanf("%d", &n); if(n == 0) return 1; point *points = new point[n]; point *points2 = new point[n]; for(int i=0;i ma_x, ma_y; map nastepny_pion; vector edges; for(int i=1;i > kre; map krawedz_uzyta; point cur_pkt = startowy; vector obwod; for(int i=0;i wynik; for(int i=0;i obwod[ (i+1)%s].y) wynik.push_back('S'); else if(obwod[i].x == obwod[ (i+1)%s ].x && obwod[i].y < obwod[ (i+1)%s].y) wynik.push_back('N'); else if(obwod[i].y == obwod[ (i+1)%s ].y && obwod[i].x > obwod[ (i+1)%s].x) wynik.push_back('W'); else if(obwod[i].y == obwod[ (i+1)%s ].y && obwod[i].x < obwod[ (i+1)%s].x) wynik.push_back('E'); } int ilp = 0, ill = 0; for(int i=0;i 0) ++ill; else ++ilp; } if(ill > ilp) { vector wyniktmp(wynik); for(int i=0;i