#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n, l; cin >> n >> l;
vector<pair<ll, ll>> stations(n);
for (auto &[x, y] : stations) {cin >> x >> y;}
double minRad = 0, maxRad = 2e9; // maxRad has to be enough to reach the ends of the highway
while (minRad <= maxRad - 1e-3) { // we have a 1e-3 (.001) leeway on the answer
double midRad = (minRad + maxRad) / 2;
double currPoint = 0; // current uncovered point on the highway
for (auto [x, y] : stations) {
double b = sqrt(midRad * midRad - y * y); // b = dist from the x coord of the station to the bound of the station's circle intersection on the highway.
double segLeft = x - b, segRight = x + b;
if (segLeft <= currPoint) {currPoint = max(currPoint, segRight);}
}
if (currPoint >= l) {maxRad = midRad;} // if all the highway has been covered
else {minRad = midRad;} // means a point was far away enough to not be covered
}
cout << minRad << setprecision(4) << '\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... |