0085. Get Out!

Input file name: out.in
Output file name: out.out
Time limit: 1 s
Memory limit: 16 megabytes

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 file

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 file

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

Examples:

out.inout.out
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 1YES
5 2 2 1.1 -2 2 1.1 2 -2 1.0 -2 -2 1.0 0 -3 0.01 0 0 1NO


Source: Petrozavodsk Winter 2003. St. Petersburg Contest II, Thursday, February 06

Discuss       Submit a solution



Printable version