#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
// ifstream cin("input.txt");
// ofstream cout("output.txt");
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll n, L; cin >> n >> L;
vector<pair<double, double>> points(n);
for (int i = 0; i < n; i++) cin >> points[i].first >> points[i].second;
double low = 0, high = 2e9;
while(high - low > 1e-5) {
double mid = (low + high) / 2;
vector<pair<double, int>> intervals;
bool can1 = true, can2 = false;
for (auto p : points) {
if (abs(mid) < abs(p.second)) can1 = false;
else {
intervals.push_back({p.first - sqrt(mid * mid - p.second * p.second), 1});
intervals.push_back({p.first + sqrt(mid * mid - p.second * p.second), -1});
}
}
sort(intervals.begin(), intervals.end(), [&](pair<double, int>& p1, pair<double, int>& p2) {
if (p1.first == p2.first) {
return (p1.second > p2.second);
} else return (p1.first < p2.first);
});
int cur_cnt = 0;
for (auto& p : intervals) {
if (p.first > L) break;
cur_cnt += p.second;
if (cur_cnt == n) can2 = true;
}
if (can1 && can2) {
high = mid;
} else {
low = mid;
}
}
cout << fixed << setprecision(5) << low << '\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... |