#include #include #include #define TRUE 1 #define FALSE 0 typedef struct clen{ long x,y; struct clen *pred; struct clen *nasl; }CLEN; long n,m,i; long sx,sy,x,y; double cx,cy,scx,scy; CLEN *prvni, *posledni, *aktualni; void vloz(long x,long y){ CLEN *pom; pom=(CLEN *) malloc(sizeof(CLEN)); pom->pred=NULL; pom->nasl=NULL; pom->x=x; pom->y=y; if (posledni!=NULL){ posledni->nasl=pom; pom->pred=posledni; } posledni=pom; if(prvni==NULL) prvni=pom; } void zrus(CLEN *pom){ if ((pom->nasl)!=NULL) pom->nasl->pred=pom->pred; if ((pom->pred)!=NULL) pom->pred->nasl=pom->nasl; if (pom==prvni) prvni=pom->nasl; if (pom==posledni) posledni=pom->pred; free(pom); } int odeber(long x,long y){ CLEN *pom; int konec,ok; konec=ok=FALSE; pom=prvni; while (!konec){ if (ok=((pom->x==x)&&(pom->y==y))){ zrus(pom); konec=TRUE; }else{ if(!(konec=(pom->nasl==0))){ pom=pom->nasl; }; }; }; return (ok); }; int main(void){ int konec,ok; long px,py; scanf("%ld",&n); m=n; while(n!=0){ prvni=NULL; posledni=NULL; scanf("%ld %ld",&x,&y); vloz(x,y); sx=x; sy=y; n--; while (n>0){ scanf("%ld %ld",&x,&y); vloz(x,y); sx+=x; sy+=y; n--; } cx=(double)sx/m; cy=(double)sy/m; if (cx>0) scx=cx+0.5; else scx=cx-0.5; if (cy>0) scy=cy+0.5; else scy=cy-0.5; sx=(long) cx; //scx sy=(long) cy; //scy scx=cx; scy=cy; konec=FALSE; ok=TRUE; while(!konec){ if ((prvni->x==sx)&&(prvni->y==sy)) zrus(prvni); else{ cx=2*scx-prvni->x; cy=2*scy-prvni->y; if (cx>0) cx=cx+0.5; else cx=cx-0.5; if (cy>0) cy=cy+0.5; else cy=cy-0.5; x=(long)cx; y=(long)cy; zrus(prvni); if (prvni==NULL) ok=FALSE; else{ if (odeber(x,y)) ok=TRUE; else { konec=TRUE; ok=FALSE; } } } if (prvni==NULL) konec=TRUE; } if(ok) printf("V.I.P. should stay at (%.1f,%.1f).\n",scx,scy); else printf("This is a dangerous situation!\n"); scanf("%ld",&n); } return 0; }