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;
const int MAXN = 1e6;
struct point {
long long x, y;
};
point receivers[MAXN];
double first_true(double low, double high, function<bool(double)> f) {
--low, ++high;
double mid;
while (high - low > 1e-3) {
mid = low + (high - low) /2;
if (f(mid)) {
high = mid;
} else {
low = mid;
}
}
return high;
}
int main() {
int n, l;
cin >> n >> l;
for (int i = 0; i < n; ++i) {
cin >> receivers[i].x >> receivers[i].y;
}
cout << fixed << setprecision(4) << first_true(0, 2e9, [&](double r) {
double high = 0;
for (int i = 0; i < n; ++i) {
double left = receivers[i].x -
sqrt(r * r - receivers[i].y * receivers[i].y);
double right = receivers[i].x +
sqrt(r * r - receivers[i].y * receivers[i].y);
if (left <= high) {
high = max(high, right);
}
}
return high >= 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... |