#include #include #define MAX_POINTS 21000 #define HASH_SIZE 65537 int xs[MAX_POINTS], ys[MAX_POINTS]; int hash[3*HASH_SIZE], run = 0; void hash_add(int x, int y) { int index = abs(x * 1999 + y) % HASH_SIZE, d = 1, s = 0; while (hash[3*index] == run && (hash[3*index+1] != x || hash[3*index+2] != y)) { s += d; d += 2; index = (index + s) % HASH_SIZE; } hash[3*index] = run; hash[3*index+1] = x; hash[3*index+2] = y; } int hash_find(int x, int y) { int index = abs(x * 1999 + y) % HASH_SIZE, s = 0, d = 1; while (hash[3*index] == run) { if (hash[3*index+1] == x && hash[3*index+2] == y) return index; s += d; d += 2; index = (index + s) % HASH_SIZE; } return -1; } int main(void) { int points, i, err; long double xc, yc; for (;;) { scanf("%d", &points); run++; xc = 0; yc = 0; if (points == 0) break; err = 0; for (i = 0; i < points; i++) { scanf("%d%d", &xs[i], &ys[i]); xc += xs[i]; yc += ys[i]; hash_add(xs[i], ys[i]); } xc = xc / points; yc = yc / points; for (i = 0; i < points; i++) { if (hash_find(2*xc - xs[i], 2*yc - ys[i]) == -1) if ((long double)xs[i] != xc || (long double)ys[i] != yc) { err = 1; break; } } if (err) printf("This is a dangerous situation!\n"); else printf("V.I.P. should stay at (%.1Lf,%.1Lf).\n", xc, yc); } return 0; }