/**
* author: FromDihPout
* created: 2022-04-18
**/
#include <bits/stdc++.h>
using namespace std;
const double EPSILON = 1e-5;
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) {
return false;
}
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(5) << lo << '\n';
return 0;
}
# |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
232 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 |
7 ms |
468 KB |
Output is correct |
3 |
Correct |
6 ms |
340 KB |
Output is correct |
4 |
Incorrect |
10 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
644 KB |
Output is correct |
2 |
Correct |
16 ms |
636 KB |
Output is correct |
3 |
Correct |
20 ms |
644 KB |
Output is correct |
4 |
Correct |
17 ms |
728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
636 KB |
Output is correct |
2 |
Correct |
16 ms |
648 KB |
Output is correct |
3 |
Correct |
16 ms |
644 KB |
Output is correct |
4 |
Correct |
17 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
680 KB |
Output is correct |
2 |
Correct |
16 ms |
636 KB |
Output is correct |
3 |
Correct |
17 ms |
644 KB |
Output is correct |
4 |
Correct |
18 ms |
636 KB |
Output is correct |
5 |
Correct |
16 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
249 ms |
4896 KB |
Output is correct |
2 |
Correct |
334 ms |
5096 KB |
Output is correct |
3 |
Correct |
184 ms |
3644 KB |
Output is correct |
4 |
Correct |
275 ms |
4988 KB |
Output is correct |
5 |
Correct |
178 ms |
3364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
271 ms |
5160 KB |
Output is correct |
2 |
Correct |
265 ms |
4704 KB |
Output is correct |
3 |
Correct |
289 ms |
5352 KB |
Output is correct |
4 |
Correct |
295 ms |
5276 KB |
Output is correct |
5 |
Correct |
318 ms |
5656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
447 ms |
5756 KB |
Output is correct |
2 |
Correct |
357 ms |
5428 KB |
Output is correct |
3 |
Correct |
354 ms |
5580 KB |
Output is correct |
4 |
Incorrect |
364 ms |
6424 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
373 ms |
6532 KB |
Output is correct |
2 |
Correct |
465 ms |
6648 KB |
Output is correct |
3 |
Correct |
405 ms |
6520 KB |
Output is correct |
4 |
Correct |
355 ms |
6548 KB |
Output is correct |
5 |
Correct |
362 ms |
6528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
387 ms |
6544 KB |
Output is correct |
2 |
Correct |
450 ms |
6616 KB |
Output is correct |
3 |
Correct |
411 ms |
6532 KB |
Output is correct |
4 |
Incorrect |
371 ms |
6528 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
31536 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
31536 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
37896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
37888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
44172 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
44092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
50348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
50448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1101 ms |
62992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
62908 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |