#include #define NMAX 1010 #define VERTICAL 1 #define HORIZONTAL 2 int g[NMAX][NMAX], fila[NMAX], marc[NMAX]; int ini, fim; struct tponto { int x; int y; }; struct paredeHorizontal { int xi, xf; int y; }; struct paredeVertical { int yi, yf; int x; }; int existeInt(struct paredeVertical v, struct paredeHorizontal h) { if (v.x>=h.xi && v.x<=h.xf && h.y>=v.yi && h.y<=v.yf) { return 1; } return 0; } int main() { int n; struct paredeHorizontal h[NMAX]; struct paredeVertical v[NMAX]; int nv=2, nh=2; int nao=0; int modx=0, mody=0; int x1, y1, x2, y2; int tmp; int i, j; int w; int tipo; scanf("%d %d %d %d %d", &n, &x1, &y1, &x2, &y2); if (n==0) { printf("S\n"); return 0; } modx=-x1; x1=0; x2+=modx; mody=-y1; y1=0; y2+=mody; v[0].x=x1; v[0].yi=y1; v[0].yf=y2; v[1].x=x2; v[1].yi=y1; v[1].yf=y2; h[0].y=y1; h[0].xi=x1; h[0].xf=x2; h[1].y=y2; h[1].xi=x1; h[1].xf=x2; for (i=1; i<=n; i++) { scanf("%d %d %d %d", &x1, &y1, &x2, &y2); if (x1==x2) { // Parede Vertical v[nv].x=x1+modx; if (y2nv) { w-=nv; tipo=HORIZONTAL; } else { tipo=VERTICAL; } if (tipo==HORIZONTAL) { for (i=0; inv) { w-=nv; tipo=HORIZONTAL; } else { tipo=VERTICAL; } if (tipo==HORIZONTAL) { for (i=0; i