Hdu 1007 (Application of separation and Control)
Quoit DesignTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 36078 Accepted Submission (s): 9379
Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.
In the field of Cyberground, the position of each toy is fixed, and the ring is carefully designed so it can only encircle one toy at a time. on the other hand, to make the game look more attractive, the ring is designed to have the largest radius. given a configuration of the field, you are supposed to find the radius of such a ring.
Assume that all the toys are points on a plane. A point is encircled by the ring if the distance between the point and the center of the ring is strictly less than the radius of the ring. if two toys are placed at the same point, the radius of the ring is considered to be 0.
Input The input consists of several test cases. for each case, the first line contains an integer N (2 <=n <= 100,000), the total number of toys in the field. then N lines follow, each contains a pair of (x, y) which are the coordinates of a toy. the input is terminated by N = 0.
Output For each test case, print in one line the radius of the ring required by the Cyberground manager, accurate up to 2 decimal places.
Sample Input
20 01 121 11 13-1.5 00 00 1.50
Sample Output
0.710.000.75
AC code:
/* Minimum vertices of the divide and conquer algorithm * // * AC code: 828 ms */# include
# Include
# Include # define MAXN 100005 // # define min (a, B) (
X-p2-> x) * (p1-> x-p2-> x) + (p1-> y-p2-> y) * (p1-> y-p2-> y ));} bool cmpx (Point * p1, Point * p2) {return p1-> x
X;} bool cmpy (Point * p1, Point * p2) {return p1-> y
Y;} double min (double a, double B) {return
> 1; double ans = min (closest (s, mid), closest (mid + 1, e); // recursively solves int I, j, cnt = 0; for (I = s; I <= e; I ++) // place the x coordinate in px [mid]. x-ans ~ Px [mid]. point in the range of x + ans is obtained {if (px [I]-> x> = px [mid]-> x-ans & px [I]-> x <= px [mid]-> x + ans) py [cnt ++] = px [I];} sort (py, py + cnt, cmpy); // sort by y coordinate for (I = 0; I
Y-py [I]-> y> = ans) break; ans = min (ans, get_dis (py [I], py [j]);} return ans;} int main () {int I, n; while (scanf ("% d", & n )! = EOF) {if (n = 0) break; for (I = 0; I