Topic Portal
Topic is relatively simple (but I'm up on the understanding become DP) recently DP top of the ...
Accuracy should be half card that causes just over 85%, to improve further improvements down ...
The following is the third of the solution:
(two points and a third difference lies only run on a monotonic sections, can be run on a single-peak intervals, the third constant is about two minutes but they are 2 to 3 times? the complexity of logn)
Direct-third to coordinate, normal-third of ideas on the line
Here write about one-third of the time interval must let about (my habit is l and r) from their recent move to the flag (or else if the value of the most likely between two flags will hang)
AC Code:
#include <iostream>
#include <queue>
#include <cstring>
#include <cmath>
#include <algorithm>
#define MAX 200020
#define ll long long
#define mod 1000000007
using namespace std;
struct node{
double x,y;
}p[MAX];
int n;
double search(double a)
{
double ans=-1;
for(int i=0;i<n;i++)
{
double now=sqrt(p[i].y*p[i].y+(p[i].x-a)*(p[i].x-a));
if(now>ans)
ans=now;
}
return ans;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
cin>>p[i].x>>p[i].y;
double l=-20000;
double r=20000;
while(l+1e-8<r)
{
double mid=(l+r)/2;
double midmid=(r+mid)/2;
if(search(mid)>search(midmid))
l=mid;
else
r=midmid;
}
printf("%.6lf",search(l));
return 0;
}
The solution is to write on the topic
mid=left+(right-left)/2;
midmid=mid+(right-mid)/2;
This slightly to avoid overflow ... learned (but obviously do not need this title)