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;
vector<pair<long long,long long>>c;long long n,l;
bool can(long double mid){
vector<pair<long double,long double>>seg;
for(int i=0;i<n;++i){
if(mid<abs(c[i].second)){
return false;
}
else {
long double delta=sqrt(mid*mid-c[i].second*c[i].second);
seg.push_back({c[i].first-delta,c[i].first+delta});
}
}
long double currub=0;
for(int i=0;i<n;++i){
if(seg[i].first<=currub){
currub=max(currub,seg[i].second);
}
}
return currub>=l;
}
int main() {
cin>>n>>l;
for(int i=0;i<n;++i){
long long x,y;cin>>x>>y;c.push_back({x,y});
}
long double lo=0;long double hi=2e9;
for(int i=0;i<45;++i){
long double mid=(lo+hi)/2;
if(can(mid)){
hi=mid;
}
else {
lo=mid;
}
}
cout<<fixed<<setprecision(9);
cout<<lo<<endl;
};
# | 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... |