Snakes
Time limit1sMemory limit128 MB
Decide whether a path exists from the west edge to the east edge of a 1000 by 1000 square while staying at distance at least r from every snake.
- Level
Medium6 of 10
- Topics
- Geometry, Union-find, Graph
- Solved
- No attempts yet
Problem
Buffalo Bill must cross a square field from its west edge to its east edge. Several snakes rest on the field; each snake can strike a fixed distance in any direction from its position. Bill is bitten if at any moment he comes strictly closer to a snake than that snake's strike distance. Determine whether Bill can cross the field without being bitten.
Input
The southwest corner of the field is at and the northwest corner at . Thus the west edge is the line and the east edge is the line , and the coordinate increases from south () to north (). Bill enters at some point on the west edge (, ) and must leave at some point on the east edge (, ).
The first line contains the number of snakes (). Each of the next lines contains three real numbers , , : the snake's location and its strike distance . Every snake lies inside the field (, ). A snake bites anything that passes strictly closer than to its location; a point at distance exactly is safe.
Output
Print Bill can make the trip. if Bill can cross from the west edge to the east edge without ever coming within striking distance of any snake. Otherwise print Bill will be bitten.