Codeforces Round #514 (Div. 2) D. Nature Reserve

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.