#include <bits/stdc++.h>
using namespace std;
void solve()
{
struct point
{
long x, y;
};
int n;
long l;
cin >> n >> l;
vector<point> coords(n);
for (int i = 0; i < n; i++)
cin >> coords[i].x >> coords[i].y;
auto valid = [&](const double &d) -> bool
{
vector<pair<double, double>> cov;
for (auto [x, y] : coords)
{
if (y * y < d * d)
{
double h = sqrt(d * d - y * y);
cov.emplace_back(x - h, x + h);
}
}
sort(cov.begin(), cov.end());
bool ended = 0;
double e = 0.0;
for (auto [x1, x2] : cov)
{
if (x1 <= e)
{
e = max(e, x2);
if (e >= l)
{
ended = 1;
break;
}
}
else
break;
}
return ended;
};
double ans = 3e9;
for (double lo = 0.5; ans - lo > 1e-4;)
{
if (double mid = (lo + ans) / 2.0; valid(mid))
ans = mid;
else
lo = mid + 1e-3;
}
cout << fixed << setprecision(5) << ans << '\n';
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(NULL);
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
248 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
4 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
4 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
604 KB |
Output is correct |
2 |
Correct |
9 ms |
600 KB |
Output is correct |
3 |
Incorrect |
12 ms |
604 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
608 KB |
Output is correct |
2 |
Correct |
9 ms |
616 KB |
Output is correct |
3 |
Correct |
11 ms |
604 KB |
Output is correct |
4 |
Correct |
8 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
620 KB |
Output is correct |
2 |
Correct |
11 ms |
604 KB |
Output is correct |
3 |
Correct |
13 ms |
604 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
5 |
Correct |
8 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
4784 KB |
Output is correct |
2 |
Correct |
270 ms |
4800 KB |
Output is correct |
3 |
Correct |
145 ms |
3124 KB |
Output is correct |
4 |
Correct |
101 ms |
4740 KB |
Output is correct |
5 |
Correct |
94 ms |
2948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
144 ms |
4872 KB |
Output is correct |
2 |
Correct |
120 ms |
4596 KB |
Output is correct |
3 |
Correct |
128 ms |
4932 KB |
Output is correct |
4 |
Correct |
111 ms |
4872 KB |
Output is correct |
5 |
Correct |
103 ms |
5072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
204 ms |
5260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
295 ms |
5524 KB |
Output is correct |
2 |
Correct |
372 ms |
5524 KB |
Output is correct |
3 |
Correct |
428 ms |
5628 KB |
Output is correct |
4 |
Correct |
84 ms |
5408 KB |
Output is correct |
5 |
Correct |
175 ms |
5524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
234 ms |
5608 KB |
Output is correct |
2 |
Correct |
367 ms |
5628 KB |
Output is correct |
3 |
Correct |
405 ms |
5528 KB |
Output is correct |
4 |
Correct |
86 ms |
5508 KB |
Output is correct |
5 |
Correct |
162 ms |
5500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
24204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
24212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
35700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
35644 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
38720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
38692 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
41892 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
41820 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
48092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
48160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |