#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);
while (!cov.empty() && cov.back().first > x - h)
cov.pop_back();
cov.emplace_back(x - h, x + h);
}
}
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-3;)
{
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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
5 ms |
604 KB |
Output is correct |
3 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
652 KB |
Output is correct |
2 |
Correct |
5 ms |
672 KB |
Output is correct |
3 |
Correct |
4 ms |
636 KB |
Output is correct |
4 |
Incorrect |
3 ms |
588 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
5316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
3640 KB |
Output is correct |
2 |
Correct |
56 ms |
3232 KB |
Output is correct |
3 |
Correct |
56 ms |
3748 KB |
Output is correct |
4 |
Correct |
46 ms |
2452 KB |
Output is correct |
5 |
Correct |
44 ms |
2184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
108 ms |
5980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
99 ms |
3960 KB |
Output is correct |
2 |
Incorrect |
77 ms |
5360 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
117 ms |
6012 KB |
Output is correct |
2 |
Incorrect |
69 ms |
5376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
629 ms |
24716 KB |
Output is correct |
2 |
Correct |
320 ms |
17496 KB |
Output is correct |
3 |
Correct |
307 ms |
17080 KB |
Output is correct |
4 |
Incorrect |
236 ms |
18392 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
323 ms |
10124 KB |
Output is correct |
2 |
Correct |
527 ms |
30880 KB |
Output is correct |
3 |
Incorrect |
393 ms |
30056 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
918 ms |
36132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
370 ms |
11744 KB |
Output is correct |
2 |
Incorrect |
672 ms |
43480 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1004 ms |
39128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
450 ms |
13280 KB |
Output is correct |
2 |
Correct |
756 ms |
47964 KB |
Output is correct |
3 |
Correct |
570 ms |
47216 KB |
Output is correct |
4 |
Incorrect |
334 ms |
25540 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
42428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
482 ms |
14864 KB |
Output is correct |
2 |
Correct |
845 ms |
52404 KB |
Output is correct |
3 |
Correct |
624 ms |
51444 KB |
Output is correct |
4 |
Correct |
384 ms |
29296 KB |
Output is correct |
5 |
Incorrect |
486 ms |
30720 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
48664 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
605 ms |
17648 KB |
Output is correct |
2 |
Execution timed out |
1010 ms |
61312 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |