ZOJ Problem Set - 1472
There are problems easy to human brain, but hard to computers. For example,
a man can tell whether two shapes overlap by a single glimpse, but a computer
will have to check this and that before giving a correct answer.
The first line of input contains an integer n which is the number of tests. Each test consists of two lines, specifying the characteristics of the two shapes. A shape specification begins with a string which is either "circle" or "rectangle". If it is a circle, then three integers follow: r, x, and y where x and y are the coordinates of the center of the circle and r is the radius. Otherwise four integers follow: x1, y1, x2, and y2, specifying the coordinates of the top-left corner and the right-bottom corner. All the coordinates will be within the range [-50000, 50000], and 0 < r < 50000.
For each test, if the two shapes overlap, print "yes" in a single line; otherwise print "no".
Author: CHEN, Shunbao
Source: ZOJ Monthly, December 2002