#include "bits/stdc++.h"
using namespace std;
const int INF = 1e9 + 7;
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
int n, L; cin >> n >> L;
vector<pair<int, int>> a(n);
for (auto &x: a) cin >> x.first >> x.second;
auto good = [&](double R) {
vector<pair<double, double>> b;
for (auto i: a) {
long long u, v; tie(u, v) = i;
#define sqr(x) (x) * (x)
double delta = sqrt(sqr(R) - sqr(v));
double x1 = -delta + u, x2 = delta + u;
b.emplace_back(x1, x2);
// cout << fixed << setprecision(10) << x1 << ' ' << x2 << '\n';
}
sort(b.begin(), b.end(), [](pair<double, double> x, pair<double, double> y) {
if (x.second == y.second) return x.first < y.first;
return x.second > y.second;
});
double l = INF, r = -INF;
for (auto i: b) {
if (l == INF) {
l = min(l, i.first);
r = max(r, i.second);
continue;
}
if (i.second < l || i.first > r) return false;
l = min(l, i.first), r = max(r, i.second);
}
return l <= 0 && r >= L;
};
double l = -1, r = 1e9 + 1;
for (int i = 1, ITER = 80; i <= ITER; ++i) {
double m = l + (r - l) / 2;
if (good(m)) r = m;
else l = m;
}
cout << fixed << setprecision(20) << r;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
580 KB |
Output is correct |
2 |
Correct |
13 ms |
644 KB |
Output is correct |
3 |
Correct |
16 ms |
924 KB |
Output is correct |
4 |
Incorrect |
19 ms |
644 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
434 ms |
4180 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
405 ms |
4364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
270 ms |
4540 KB |
Output is correct |
2 |
Correct |
462 ms |
4360 KB |
Output is correct |
3 |
Correct |
346 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
564 ms |
4744 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
475 ms |
4756 KB |
Output is correct |
2 |
Correct |
593 ms |
4904 KB |
Output is correct |
3 |
Correct |
405 ms |
4888 KB |
Output is correct |
4 |
Incorrect |
611 ms |
4864 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
323 ms |
4780 KB |
Output is correct |
2 |
Correct |
602 ms |
4860 KB |
Output is correct |
3 |
Correct |
383 ms |
4816 KB |
Output is correct |
4 |
Incorrect |
570 ms |
4848 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
20544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
20296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
31004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
30904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
33228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
33216 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
35648 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
35572 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1057 ms |
40288 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
40360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |