#P5696. [CTSC1998] 监视摄像机

    ID: 4707 远端评测题 500ms 50MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>计算几何1998WC/CTSC/集训队半平面交

[CTSC1998] 监视摄像机

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