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;
using pii = pair<int, int>;
using tiiii = tuple<int, int, ll, ll>;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n, L; cin >> n >> L;
vector < int > x(n), y(n);
for (int i = 0; i < n; i++)
cin >> x[i] >> y[i];
auto Good = [&](double dist) {
double r = 0;
for (int i = 0; i < n; i++) {
if (y[i] > dist)
continue;
double left = x[i] - sqrtl(dist * dist - y[i] * y[i]);
double right = x[i] + sqrtl(dist * dist - y[i] * y[i]);
if (r < left)
return false;
r = max(r, right);
}
return r > L;
};
double l = 0, m, r = 2e+9;
for (int i = 0; i < 100; i++) {
m = (l + r) / 2;
if (Good(m))
r = m;
else
l = m;
}
cout << setprecision(16) << fixed << r << "\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... |