#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
// freopen("landin.txt", "r", stdin);
// freopen("landout.txt", "w", stdout);
int n; double l;
vector<pair<ll,ll>>a;
bool check(double radius){
double start=0;
for(int i=0; i<n; i++){
double delta=sqrt(radius*radius-a[i].second*a[i].second);
double left=a[i].first-delta; double right=a[i].first+delta;
if(left<=start)start=max(start,right);
}
if(start>=l)return true;
return false;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>l; a.resize(n);
for(int i=0; i<n; i++){
cin>>a[i].first>>a[i].second;
}
double left=1; double right=1.5*(1e9); double prec=1e-3;
while(right-left>prec){
double mid=(left+right)/2;
if(check(mid))right=mid;
else left=mid;
}
cout<<fixed<<setprecision(3)<<left<<'\n';
}
# | 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... |