Problem N
Faster Than Light
Faster Than Light (FTL) is a space-based top-down strategy game by Subset Games. You control a ship which belongs to the Galactic Federation and have to fight a ship of the Rebel Faction. The enemies’ spaceship is represented by a set of axis-aligned non-intersecting rectangles in the plane which correspond to the rooms of the ship. Your ship is close to destruction, but your weapon, the hull beam, is ready to fire.
The hull beam shoots an infinite beam in a direction of your
choice that deals one damage to each room it intersects.
Coincidentally, the enemies’ ship consists of
![\includegraphics[width=0.5\textwidth ]{sample}](/problems/fasterthanlight/file/statement/en/img-0001.png)
Input
The input consists of:
-
One line with an integer
, the number of rooms. -
lines, each with four integers , , , and ( and ), describing the coordinates of two opposite corners ( , ) and ( , ) of a room.
It is guaranteed that no two rooms have a common interior point.
Output
If it is possible for the hull beam to pass through all rooms at once, output “possible”. Otherwise, output “impossible”.
Sample Input 1 | Sample Output 1 |
---|---|
5 1 3 3 4 2 2 4 3 4 1 5 3 5 2 7 3 6 3 8 4 |
possible |
Sample Input 2 | Sample Output 2 |
---|---|
4 1 1 2 2 1 3 2 4 3 1 4 2 3 3 4 4 |
impossible |
Sample Input 3 | Sample Output 3 |
---|---|
3 1 1 2 2 1 3 2 4 3 3 4 4 |
possible |