Http://codeforces.com/contest/1059/problem/D
Maximum value:
The bottom left and right bottom have one point respectively
R^2-(r-1) ^2 = (10^7) ^2
Maxr<0.5*10^14
Way1:
Two points.
Difference:
If you use 5*10^13-10^-6,2^ 60~70 interval, the pow,sqrt operation, the measured timeout.
is actuallyUse.
Time of a case:->
Code:
1#include <bits/stdc++.h>2 using namespacestd;3 Const intmaxn=1e5+Ten;4 5 DoubleX[MAXN],Y[MAXN];6 Doublez=5.0*1e13;7 intN;8 9 BOOLWorkDoublem)Ten { One Doublep,q,d; A inti; -P=-z; q=Z; - for(i=1; i<=n;i++) the { -D=sqrt (Pow (M,2)-pow (M-y[i],2)); -P=max (p,x[i]-d); -Q=min (q,x[i]+d); + //if (p>q) - //return 0; + } A //return 1; at if(p<=q) - return 1; - Else - return 0; - } - in intMain () - { to DoubleL=0, r,m; + intv,i; -scanf"%d",&n); thev=0; * for(i=1; i<=n;i++) $ {Panax Notoginsengscanf"%LF%LF",&x[i],&y[i]); - if(y[i]!=0) the { + if(v==0) Av= (y[i]>0); the Else if(V!= (y[i]>0)) + { -printf"-1"); $ return 0; $ } - } -y[i]=fabs (Y[i]); theL=max (l,y[i]/2); - }WuyiR=Z; the while((r-l)/max (1.0, l) >1e-6) - { WuM= (L+R)/2; - if(Work (m)) AboutR=m; $ Else -L=m; - } -printf"%.10f", R); A return 0; +}
Way2:
Multiple two functions F1,f2,..., FN,
F (x) =max (F1 (x), F2 (x),..., fn (x)),
And F is first reduced, then enlarged, using a three-point method
Similar:
hdu4717 The Moving Points
Codeforces Round #514 (Div. 2) D. Nature Reserve