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 int double
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n,L; cin >> n >> L;
vector<pair<double,double>> a;
int N=0;
for (int i = 0; i < n; i++){
int x,y; cin >> x >> y;
y=abs(y);
if(i>0&&a[N-1].first==x) a[N-1].second=min(a[N-1].second,y);
else{
N++;
a.push_back({x,y});
}
}
int l=0,r=1e9;
while(r-l>0.0003){
int mid=(l+r)/2;
int rght=0;
for (int i = 0; i < N; i++)
{
if(mid<a[i].second) continue;
int pnt1=sqrt((mid*mid)-(a[i].second*a[i].second));
if(a[i].first-pnt1<=rght) rght=max(rght, pnt1+a[i].second);
}
if(rght>=L) {
r=mid;
}else{
l=mid;
}
}
cout << setprecision(5) << fixed << (double)l << "\n";
return 0;
}
# | 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... |