ZOJ Problem Set - 2318
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.
This problem contains multiple test cases!
The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.
The output format consists of N output blocks. There is a blank line between output blocks.
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 YES if Kolobok can leave archipelago and NO if it cannot.
Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #1