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;
using ll = long long ;
ll n, l;
ll x[1000005], y[1000005];
bool Can(double R) {
double D, x1, x2, mx = 0.0;
for (int j = 1; j <= n; j ++) {
D = R * R - y[j] * y[j];
D = sqrt(D);
x1 = x[j] - D;
x2 = x[j] + D;
if ( x1 <= mx) mx = max(mx,x2);
}
if ( mx < l) return false;
return true;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll i;
double lo , hi, mid;
cin >> n >> l;
for (i = 1; i <= n; i ++) {
cin >> x[i] >> y[i];
}
lo = 0;
hi = 1.5e9;
while (hi - lo > 1e-3) {
mid = (lo + hi)/2;
if (!Can(mid)) lo = mid;
else hi = mid;
}
cout << fixed << setprecision(4) << lo << "\n";
}
# | 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... |