/**
* author: FromDihPout
* created: 2022-04-18
**/
#include <bits/stdc++.h>
using namespace std;
const double EPSILON = 1e-3;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, l;
cin >> n >> l;
vector<array<double, 2>> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i][0] >> p[i][1];
}
auto check = [&](double r) {
vector<pair<double, double>> intervals(n);
for (int i = 0; i < n; i++) {
if (p[i][1] >= r) continue;
double length = sqrt((r * r) - (p[i][1] * p[i][1]));
intervals.emplace_back(p[i][0] - length, p[i][0] + length);
}
sort(intervals.begin(), intervals.end());
double end = 0.0;
for (auto [left, right] : intervals) {
if (left > end) continue;
end = max(end, right);
}
return end >= l;
};
double lo = 0, hi = 1e10;
while (hi - lo > EPSILON) {
double mid = (lo + hi) / 2;
if (check(mid)) {
hi = mid;
} else {
lo = mid;
}
}
cout << fixed << setprecision(4) << lo << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
468 KB |
Output is correct |
2 |
Correct |
8 ms |
468 KB |
Output is correct |
3 |
Correct |
6 ms |
460 KB |
Output is correct |
4 |
Correct |
11 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
676 KB |
Output is correct |
2 |
Correct |
15 ms |
708 KB |
Output is correct |
3 |
Correct |
16 ms |
684 KB |
Output is correct |
4 |
Correct |
15 ms |
708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
688 KB |
Output is correct |
2 |
Correct |
15 ms |
708 KB |
Output is correct |
3 |
Correct |
20 ms |
672 KB |
Output is correct |
4 |
Correct |
17 ms |
708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
756 KB |
Output is correct |
2 |
Correct |
14 ms |
708 KB |
Output is correct |
3 |
Correct |
17 ms |
832 KB |
Output is correct |
4 |
Correct |
15 ms |
712 KB |
Output is correct |
5 |
Correct |
15 ms |
672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
220 ms |
5756 KB |
Output is correct |
2 |
Correct |
303 ms |
5656 KB |
Output is correct |
3 |
Correct |
166 ms |
4088 KB |
Output is correct |
4 |
Correct |
264 ms |
5512 KB |
Output is correct |
5 |
Correct |
156 ms |
3732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
262 ms |
5900 KB |
Output is correct |
2 |
Correct |
232 ms |
5172 KB |
Output is correct |
3 |
Correct |
268 ms |
5812 KB |
Output is correct |
4 |
Correct |
283 ms |
5772 KB |
Output is correct |
5 |
Correct |
283 ms |
6180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
411 ms |
6452 KB |
Output is correct |
2 |
Correct |
319 ms |
6072 KB |
Output is correct |
3 |
Correct |
353 ms |
6120 KB |
Output is correct |
4 |
Correct |
336 ms |
7056 KB |
Output is correct |
5 |
Correct |
335 ms |
6776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
365 ms |
8064 KB |
Output is correct |
2 |
Correct |
419 ms |
7456 KB |
Output is correct |
3 |
Correct |
390 ms |
7040 KB |
Output is correct |
4 |
Correct |
333 ms |
7040 KB |
Output is correct |
5 |
Correct |
360 ms |
7060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
362 ms |
8052 KB |
Output is correct |
2 |
Correct |
447 ms |
7356 KB |
Output is correct |
3 |
Correct |
371 ms |
7044 KB |
Output is correct |
4 |
Correct |
353 ms |
7076 KB |
Output is correct |
5 |
Correct |
333 ms |
7792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
33180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
33196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
39444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
38924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
45640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
45140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
51956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
51508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
64192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
63084 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |