#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;
stack<double> s;
s.push(0);
double p = 0;
for(int i = 0;i < n;i++){
// cout << x[i] - sqrt(r*r-y[i]*y[i]) << " sinistra e destra " << x[i] + sqrt(r*r-y[i]*y[i]) << endl;
while(!s.empty()){
double a = s.top();
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;
}
s.pop();
}
s.push(p);
}
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... |