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;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
ll L;
cin >> n >> L;
vector <pair<ll,ll>> pts;
for(int i=0; i<n; i++){
ll x, y;
cin >> x >> y;
if(!pts.empty() && x == pts.back().first){
pts.back().second = min(pts.back().second, abs(y));
}
else{
pts.push_back({x,abs(y)});
}
}
n = pts.size();
const ld EPS = 1e-8;
ld l=0, r=1e10, mid;
while(r-l>EPS){
mid = (l+r)/2;
vector <pair<ld,ld>> seg;
for(int i=0; i<n; i++){
ld x = pts[i].first, y = pts[i].second;
if(mid <= y){
continue;
}
ld d = sqrt(mid*mid-y*y);
seg.push_back({max((ld)0.0, x-d),min((ld)L, x+d)});
}
sort(seg.begin(), seg.end());
vector <pair<ld,ld>> processed;
for(auto [start,end] : seg){
if(!processed.empty() && start<=processed.back().second){
processed.back().second = max(processed.back().second, end);
}
else{
processed.push_back({start, end});
}
}
bool can = false;
if(processed.size() == 1){
auto [x,y] = processed[0];
if(abs(x) < EPS && abs(y-L) < EPS){
can = true;
}
}
if(can) r = mid;
else l = mid;
}
cout << fixed << setprecision(6) << 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... |