#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-5;)
{
if (double mid = (lo + ans) / 2.0; valid(mid))
ans = mid;
else
lo = mid + 1e-4;
}
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 |
204 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 |
256 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 |
7 ms |
616 KB |
Output is correct |
2 |
Correct |
11 ms |
764 KB |
Output is correct |
3 |
Correct |
13 ms |
604 KB |
Output is correct |
4 |
Correct |
6 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
612 KB |
Output is correct |
2 |
Correct |
12 ms |
604 KB |
Output is correct |
3 |
Correct |
15 ms |
604 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
608 KB |
Output is correct |
2 |
Correct |
10 ms |
612 KB |
Output is correct |
3 |
Correct |
15 ms |
604 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
5 |
Correct |
8 ms |
608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
156 ms |
4784 KB |
Output is correct |
2 |
Correct |
284 ms |
5168 KB |
Output is correct |
3 |
Correct |
162 ms |
3040 KB |
Output is correct |
4 |
Correct |
107 ms |
4740 KB |
Output is correct |
5 |
Correct |
93 ms |
2936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
149 ms |
4852 KB |
Output is correct |
2 |
Correct |
129 ms |
4596 KB |
Output is correct |
3 |
Correct |
129 ms |
4852 KB |
Output is correct |
4 |
Correct |
112 ms |
4856 KB |
Output is correct |
5 |
Correct |
106 ms |
5072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
234 ms |
5380 KB |
Output is correct |
2 |
Correct |
318 ms |
4980 KB |
Output is correct |
3 |
Correct |
362 ms |
5112 KB |
Output is correct |
4 |
Correct |
85 ms |
5432 KB |
Output is correct |
5 |
Correct |
179 ms |
5176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
309 ms |
5528 KB |
Output is correct |
2 |
Correct |
385 ms |
5536 KB |
Output is correct |
3 |
Correct |
433 ms |
5524 KB |
Output is correct |
4 |
Correct |
87 ms |
5508 KB |
Output is correct |
5 |
Correct |
173 ms |
5508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
5660 KB |
Output is correct |
2 |
Correct |
386 ms |
5528 KB |
Output is correct |
3 |
Correct |
446 ms |
5516 KB |
Output is correct |
4 |
Correct |
90 ms |
5520 KB |
Output is correct |
5 |
Correct |
155 ms |
5508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
24308 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1044 ms |
24268 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
35680 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
35632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
38704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
38728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
41900 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
41944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
48304 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
48116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |