This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define vv vector<lli>
#define vvi vector<vector<int>>
#define vii vector<pr>
#define pr pair<double,double>
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define lli long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define mkp make_pair
#define fast ios::sync_with_stdio(false);cin.tie(0);
int l,n;
vector<pr > v;
pr g(double r, double x, double y){
pr res={0,0};
if (abs(y)>=r)return res;
r=r*r;
res.first=x-sqrt(r-(y*y));
res.second=x+sqrt(r-(y*y));
return res;
}
bool check(double r){
vector<pr> q(n+1);
//q[n]=make_pair(0,0);
q[n]=make_pair(l,l);
FOR(i,0,n){
q[i]=g(r,v[i].first, v[i].second);
}
sort(q.begin(),q.end());
double last=0;
pr lll=make_pair(l,l);
FOR(i,0,n){
if (q[i].first>last)return false;
if (q[i]==lll)return true;
last=max(last, q[i].second);
}
return true;
}
void fun(){
double l,m, r;
l=0;
r=1000000000;
FOR(i,0,1000){
m=(l+r)/2;
if (check(m))r=m;
else l=m;
}
if (check(l))r=l;
cout<<r<<endl;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
// freopen("out.txt", "w", stdout);
cin>>n>>l;
v=vector<pr>(n);
FOR(i,0,n)cin>>v[i].first>>v[i].second;
fun();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |