#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define ll long long
int main(){
ll n,le;
cin >> n >> le;
double x[n];
double y[n];
for(int i = 0;i < n;i++){
cin >> x[i] >> y[i];
}
double ra = 0;
double rb = 1e12;
while(rb-ra > 0.0001){
double r = (rb-ra)/2+ra;
// r = 5.99;
// cout << ra << " " <<rb << " r " << r;
double p = 0;
for(int i = 0;i < n;i++){
double a = p;
if(r-y[i] > 0 && (x[i]-sqrt(r*r-y[i]*y[i])) <= a && x[i]+(sqrt(r*r-y[i]*y[i])) > a){
p = x[i]+sqrt(r*r-y[i]*y[i]);
break;
}
}
if(p >= le){
rb = r;
}
else{
ra = r;
}
// break;
}
cout << ra << 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... |