<PREV Problem:
NEXT>
Solved by 44 users: Artur, robotact, DD, NSI, Dmitry_Gozman, dan, noir_soleil, Awk, MasterZerg, mikleb, dragonghy, Ilya, ich, mishik, andyzh1314, Rizvanov, shangjingbo, Wind_Love, tourist, pmnox, zloy_mipt, mazahaka, RAVEman, MaxBuzz, UdH-WiNGeR, ilyakor, defrager, Ravent, topspin, superzz, Dest, EAA2008, ripatti, s01A15, Jacob, vi002, CoJIMuP, checkil, oleg.dudrov, Robert_Gerbicz, regmar, max-spilet, murphy, avg79.
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Spheres intersection

Time limit = 2 second(s)

You are give set of closed (closed = contain boundary) spheres in 3-dimentional euclidian space. You should check if they have common point.

Input. The fist line contains number of spheres N, 1 < N ≤ 20, and then N lines go, each with four integer numbers Xi Yi Zi and Ri. All numbers less than 10000 in their absolute value.

Output. YES or NO.

Input#1
2
0 0 0 1
0 0 2 1

Output#1
YES

Input#2
2
0 0 0 1
2 2 2 2

Output#2
NO

Input#3
4
0 0 0 3
0 0 4 3
0 5 0 4
0 6 0 5

Output#3
YES

Input#4
4
0 0 0 3
0 0 4 3
0 5 0 4
0 6 0 4
Output#4
NO

Author:
Artem Voroztsov, played at regional student personal contest in Moscow, 29 April 2005.
1 May 2005

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 23.20.166.68