#include #include #include #include #include using namespace std; #define cin fin class Point { public: int x, y; }; vector P; bool compute() { int xmax = INT_MAX; int xmin = INT_MIN; int ymax = INT_MAX; int ymin = INT_MIN; for ( int i = 0; i < P.size(); i++ ) { const int x1 = P[i].x; const int y1 = P[i].y; const int x2 = P[(i+1)%P.size()].x; const int y2 = P[(i+1)%P.size()].y; if ( x1 == x2 && y1 > y2 ) xmax = min(xmax, x1); else if ( x1 == x2 && y1 < y2 ) xmin = max(xmin, x1); else if ( y1 == y2 && x1 < x2 ) ymax = min(ymax, y1); else if ( y1 == y2 && x1 > x2 ) ymin = max(ymin, y1); else assert( false ); } if ( xmin <= xmax && ymin <= ymax ) return true; return false; } int main() { ifstream fin("video.txt"); for ( int n = 1; true; n++ ) { int npoint; cin >> npoint; if ( npoint == 0 ) break; P.resize(npoint); for ( int i = 0; i < npoint; i++ ) cin >> P[i].x >> P[i].y; cout << "Floor #" << n << endl; if (compute() ) cout << "Surveillance is possible." << endl; else cout << "Surveillance is impossible." << endl; cout << endl; } return 0; }