Hobbiton Farms
InterviewTime limit1sMemory limit128 MB
For each test case, decide whether a circle and an axis-aligned rectangle share at least one point.
- Level
Easy3 of 10
- Topics
- Geometry, Implementation, Math
- Solved
- No attempts yet
Problem
The Home Owners Association (HOA) of Hobbiton — the village in the Shire where Bilbo lives — wants to draw a new map that shows the exact boundaries of every house's land parcel. This is tricky, because a parcel may be shaped either as a circle or as an axis-aligned rectangle.
Before drawing the map, the HOA wants to confirm that its records are consistent, and in particular that no two parcels overlap. It already knows how to test two circles against each other, and two rectangles against each other. It needs your help with the remaining case: one parcel is a rectangle and the other is a circle.
For each pair, decide whether the circle and the rectangle overlap, i.e. whether they share at least one common point.

Input
The first line contains the number of test cases (with ). Each of the next lines contains one test case: seven positive real numbers (of type double)
- , , — the radius and the center of the circle;
- , — the lower-left corner of the axis-aligned rectangle;
- , — the upper-right corner of the rectangle.
All seven numbers are positive.
Output
For each test case, print exactly one line. If the circle and the rectangle overlap, print
The given circle and rectangle overlap.
Otherwise print
The given circle and rectangle do not overlap.