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;
int n;
double L, x[1000100], y[1000100], l = 0, r = 1e9;
vector<pair<double, double>> vc;
bool solve(double mid){
vc.clear();
double ans = 0;
for(int i=1; i<=n; i++) {
int dis = sqrt(mid*mid - y[i]*y[i]);
vc.emplace_back(x[i] - dis, x[i] + dis);
}
for(auto i: vc) if(i.first <= ans) ans = max(ans, i.second);
if(ans >= L) return 1;
else return 0;
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> L;
for(int i = 1; i<=n; ++i){
cin >> x[i] >> y[i];
}
while(l+0.0001 < r){
double mid = (l + r) / 2.0;
if(solve(mid)) r = mid;
else l = mid + 0.0001;
}
cout << fixed << setprecision(6) << l;
}
# | 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... |