#K48602. Circle and Rectangle Overlap
Circle and Rectangle Overlap
Circle and Rectangle Overlap
You are given a circle and an axis-aligned rectangle. The circle is defined by its center ((x_c, y_c)) and its radius (r), while the rectangle is defined by its bottom-left corner ((x_{bl}, y_{bl})) and its top-right corner ((x_{tr}, y_{tr})). Determine whether the circle and the rectangle overlap. Two shapes overlap if they share at least one point. One way to decide the overlap is to compute the point ((x_{closest}, y_{closest})) in the rectangle that is closest to the circle's center and then check whether
[ (x_c - x_{closest})^2 + (y_c - y_{closest})^2 \leq r^2 ]
If the above condition holds true, then the circle and rectangle overlap; otherwise, they do not.
inputFormat
The input consists of a single line of 7 space-separated integers: (x_c), (y_c), (r), (x_{bl}), (y_{bl}), (x_{tr}), and (y_{tr}). These represent the x-coordinate and y-coordinate of the circle's center, the circle's radius, and the coordinates of the bottom-left and top-right corners of the rectangle, respectively.
outputFormat
Output a single string: either "Overlap" if the circle and rectangle overlap, or "No Overlap" if they do not.## sample
0 0 5 -1 -1 2 2
Overlap