198. Get Out!
time limit per test: 0.25
sec.
memory limit per test: 65536
KB
input: standard
output: standard
Captain Faraway on his famous circular ship Kolobok is lost among the islands of the archipelago that he has just discovered. Now 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 x_{i}, y_{i}, r_{i} — coordinates of center and radius of the ith 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 test(s)
Input
Test #1
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
Test #2
5
2 2 1.1
2 2 1.1
2 2 1.0
2 2 1.0
0 3 0.01
0 0 1
Output
Test #1
YES
Test #2
NO
Author:  Andrew Stankevich

Resource:  Petrozavodsk Winter Trainings 2003

Date:  20030206

Server time: 20160625 11:46:36  Online Contester Team © 2002  2016. All rights reserved. 

