This page is still under construction.

Parts of this page are still being built. What you see may change.

Snakes

Time limit1sMemory limit128 MB

Summary
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 1000×10001000 \times 1000 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 (0,0)(0, 0) and the northwest corner at (0,1000)(0, 1000). Thus the west edge is the line x=0x = 0 and the east edge is the line x=1000x = 1000, and the yy coordinate increases from south (00) to north (10001000). Bill enters at some point on the west edge (x=0x = 0, 0≤y≤10000 \le y \le 1000) and must leave at some point on the east edge (x=1000x = 1000, 0≤y≤10000 \le y \le 1000).

The first line contains the number of snakes nn (0≤n≤10000 \le n \le 1000). Each of the next nn lines contains three real numbers xx, yy, rr: the snake's location (x,y)(x, y) and its strike distance rr. Every snake lies inside the field (0≤x≤10000 \le x \le 1000, 0≤y≤10000 \le y \le 1000). A snake bites anything that passes strictly closer than rr to its location; a point at distance exactly rr 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.

Examples2

  1. Example 1

    Input
    3
    500 500 499
    0 0 999
    1000 1000 200
    
    Expected output
    Bill can make the trip.
    
  2. Example 2

    Input
    3
    500 900 250
    500 500 250
    500 100 250
    
    Expected output
    Bill will be bitten.