#P5696. [CTSC1998] 监视摄像机

[CTSC1998] 监视摄像机

Background

CTSC1998 D1T2.

A famous warehouse management company, SERKOI, asks your company to install a CCTV surveillance system for it.

Because SERKOI has limited funds, each room can only have one camera for surveillance, but its lens can rotate in any direction.

Problem Description

Our task is to determine the camera position so that every corner of the room can be monitored by it.

For example, Figure 1 and Figure 2 are sketches of two rooms. Each room is represented by a closed polygon.

Each edge in the figure represents a wall.

For the room in Figure 1, placing the camera at the black point meets the requirement.

For the room in Figure 2, no matter where the camera is placed, the requirement cannot be met.

Write a program that, given a room sketch, determines whether it is possible to place one camera somewhere inside the room so that it can monitor any corner of the room.

Input Format

The input contains one or more room descriptions.

The first line of each description is a positive integer nn, indicating that the room sketch is an nn-gon.

The next nn lines each contain two integers x,yx, y separated by spaces, which are the coordinates of the nn vertices of the polygon in the Cartesian coordinate system, listed in clockwise order.

n=0n = 0 indicates the end of input.

Output Format

For each room, first output one line with the room index in the format Room #k:, where kk starts from 11 in the input order.

The next line is the result. If placing a camera somewhere in the room can satisfy the condition, output Surveillance is possible.; otherwise output Surveillance is impossible.

Print a blank line between the outputs of every two rooms.

4
0 0
0 1
1 1
1 0
8
0 0 
3 0
4 3
2 2
3 4
4 4
4 5
0 5
0

Room #1:
Surveillance is possible.

Room #2:
Surveillance is impossible.

Hint

Constraints

4n1004 \leq n \leq 10010000x,y10000-10000 \leq x, y \leq 10000

Translated by ChatGPT 5