Jetpack Sniper 3000 Fragfest Extreme
Time limit1sMemory limit128 MB
For each of several 10x10 height grids and four 3D points, decide whether a building blocks the segment from you to players A, B, and C.
- Level
Hard8 of 10
- Topics
- Geometry, Implementation, Brute force
- Solved
- No attempts yet
Problem
You are a beta tester for a new online game, Jetpack Sniper 3000 Fragfest Extreme. Players wearing jetpacks fly over a metropolitan area and try to shoot one another with laser guns. The only cover is the city's ever-present glass skyscrapers.
To help you play, you have written a program that reports which players you can currently shoot (or be shot by): the players who have an unobstructed straight-line view of your position.
Input
The first line contains a single integer , the number of cities.
Each city is a grid of city blocks. Every block holds one skyscraper whose integer height ranges from to . A city is given as lines of digits; the digit in row (from the top, -indexed) and column (from the left, -indexed) is the height of the skyscraper occupying that block.
After the grid comes one line with four coordinate triples. The first is your position; the next three are the positions of players A, B, and C. Each position is written as (x, y, height), where increases from left to right, increases from top to bottom, and height is measured upward from the ground. The point is the top-left corner of the grid at ground level.
Notes:
- Coordinates may be floating-point numbers.
- No player (including you) is ever inside a building or on its surface, edges, or corners. No line of sight is tangent to a face, edge, or corner of a building in a way that would change the answer.
Output
For each city, print the header Fragfest City #X, where X is the city's number ( for the first city, for the second, and so on). Then print one line for each of players A, B, and C, in that order: print Player Y is in sight if no building blocks your straight-line view of that player, or Player Y is hiding if a building obstructs it (Y is the player's letter).
Assume the following simplifications:
- Each skyscraper is a rectangular box of size .
- Each player is a single point.
- A player never blocks the view of another player.