Get Out!

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

      Captain Faraway on his famous circular ship Kolobok is lost among the islands of the archipelago that he has just discovered. No he wonders whether he can get out of there. Help him!
      All islands in the archipelago can be composed of pieces that have circular form. You are given the map of archipelago and the position of captain. Find out whether captain can get out of there, i.e. can get as far from the point he is in the beginning as he likes.

Input

      The first line contains N — the number of circular island parts (1 ≤ N ≤ 300). N lines follow, each containing xi, yi, ri— coordinates of center and radius of the i-th circle. All coordinates and radii are real. Objects may overlap with each other in arbitrary way. All objects are considered solid.
      The last line of the input file contains three real numbers — coordinates of the center of Kolobok and its radius.
      You may consider Kolobok to be the perfect circle and that it is in the free area in the beginning. Kolobok can move along any trajectory and is so strong that he can even touch islands, but no nonzero part of island must intersect Kolobok during his motion. You may assume that making calculations with the precision of 10-6 is satisfactory.

Output

      Output YES if Kolobok can leave archipelago and NO if it cannot.

Sample Input

7
2 2 1.1
-2 2 1.1
2 -2 1.0
-2 -2 1.0
2 -5 1.0
0 -8 1.0
-2 -6 1.0
0 0 1
5
2 2 1.1
-2 2 1.1
2 -2 1.0
-2 -2 1.0
0 -3 0.01
0 0 1

Sample Output

YES
NO

Source

Andrew Stankevich Contest 1

Manager

Information
Solved Number49
Submit Number162
Problem Tags
shortest paths
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel