// Gokuri #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FNAME "video.txt" #define fin cin #define EPSILON 1.0E-6 typedef complex point; typedef vector polygon; struct area { int xmin, ymin; int xmax, ymax; }; bool solve(const polygon& p) { area a; a.xmin = a.ymin = INT_MAX; a.xmax = a.ymax = INT_MIN; for(int i = 0; i < p.size(); i++) { const point pt = p[i]; if(pt.real() < a.xmin) a.xmin = pt.real(); if(pt.real() > a.xmax) a.xmax = pt.real(); if(pt.imag() < a.ymin) a.ymin = pt.imag(); if(pt.imag() > a.ymax) a.ymax = pt.imag(); } for(int i = 0; i < p.size(); i++) { const point p1 = p[i], p2 = p[(i + 1) % p.size()]; if(p1.real() == p2.real()) { // tate if(p1.imag() > p2.imag()) { if(a.xmax > p1.real()) a.xmax = p1.real(); } else if(p1.imag() < p2.imag()) { if(a.xmin < p1.real()) a.xmin = p1.real(); } else abort(); } else if(p1.imag() == p2.imag()) { // yoko if(p1.real() < p2.real()) { if(a.ymax > p1.imag()) a.ymax = p1.imag(); } else if(p1.real() > p2.real()) { if(a.ymin < p1.imag()) a.ymin = p1.imag(); } else abort(); } else abort(); } if(a.xmax >= a.xmin && a.ymax >= a.ymin) return true; else return false; } int main(void) { ifstream fin(FNAME); if (!fin) { return 1; } // INPUT HERE int ncase = 0; int np; while(cin >> np, np) { polygon pol; while(np--) { int x, y; cin >> x >> y; pol.push_back(point(x, y)); } cout << "Floor #" << ++ncase << endl; cout << "Surveillance is " << (solve(pol) ? "possible" : "impossible") << "." << endl; cout << endl; } return 0; }