#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;
cov.reserve(2 * n);
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);
}
}
// 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 |
0 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 |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
400 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
484 KB |
Output is correct |
4 |
Correct |
4 ms |
460 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 |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
3 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
2656 KB |
Output is correct |
2 |
Correct |
61 ms |
2508 KB |
Output is correct |
3 |
Correct |
33 ms |
1996 KB |
Output is correct |
4 |
Correct |
50 ms |
1884 KB |
Output is correct |
5 |
Correct |
26 ms |
1488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
2124 KB |
Output is correct |
2 |
Correct |
46 ms |
2200 KB |
Output is correct |
3 |
Correct |
53 ms |
2636 KB |
Output is correct |
4 |
Correct |
46 ms |
1996 KB |
Output is correct |
5 |
Correct |
47 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
3012 KB |
Output is correct |
2 |
Correct |
60 ms |
2632 KB |
Output is correct |
3 |
Correct |
45 ms |
2924 KB |
Output is correct |
4 |
Correct |
46 ms |
1900 KB |
Output is correct |
5 |
Correct |
58 ms |
2488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
2840 KB |
Output is correct |
2 |
Correct |
76 ms |
2888 KB |
Output is correct |
3 |
Correct |
62 ms |
3428 KB |
Output is correct |
4 |
Correct |
50 ms |
1900 KB |
Output is correct |
5 |
Correct |
69 ms |
3144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
3424 KB |
Output is correct |
2 |
Correct |
67 ms |
2912 KB |
Output is correct |
3 |
Correct |
64 ms |
3424 KB |
Output is correct |
4 |
Correct |
48 ms |
1880 KB |
Output is correct |
5 |
Correct |
64 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
334 ms |
15940 KB |
Output is correct |
2 |
Correct |
372 ms |
8912 KB |
Output is correct |
3 |
Correct |
347 ms |
8904 KB |
Output is correct |
4 |
Correct |
286 ms |
8432 KB |
Output is correct |
5 |
Correct |
330 ms |
18244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
360 ms |
8908 KB |
Output is correct |
2 |
Correct |
418 ms |
15956 KB |
Output is correct |
3 |
Correct |
286 ms |
15960 KB |
Output is correct |
4 |
Correct |
280 ms |
17860 KB |
Output is correct |
5 |
Correct |
304 ms |
17348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
405 ms |
19088 KB |
Output is correct |
2 |
Correct |
423 ms |
19808 KB |
Output is correct |
3 |
Correct |
404 ms |
19256 KB |
Output is correct |
4 |
Correct |
302 ms |
21896 KB |
Output is correct |
5 |
Correct |
399 ms |
21724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
450 ms |
10468 KB |
Output is correct |
2 |
Correct |
483 ms |
19056 KB |
Output is correct |
3 |
Correct |
337 ms |
25924 KB |
Output is correct |
4 |
Correct |
299 ms |
21732 KB |
Output is correct |
5 |
Correct |
375 ms |
20676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
472 ms |
22280 KB |
Output is correct |
2 |
Correct |
506 ms |
22920 KB |
Output is correct |
3 |
Correct |
513 ms |
22272 KB |
Output is correct |
4 |
Correct |
349 ms |
25212 KB |
Output is correct |
5 |
Correct |
495 ms |
25212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
472 ms |
12028 KB |
Output is correct |
2 |
Correct |
574 ms |
22224 KB |
Output is correct |
3 |
Correct |
390 ms |
22192 KB |
Output is correct |
4 |
Correct |
337 ms |
11648 KB |
Output is correct |
5 |
Correct |
449 ms |
23964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
537 ms |
25288 KB |
Output is correct |
2 |
Correct |
583 ms |
26020 KB |
Output is correct |
3 |
Correct |
526 ms |
25240 KB |
Output is correct |
4 |
Correct |
400 ms |
28876 KB |
Output is correct |
5 |
Correct |
526 ms |
27912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
537 ms |
13600 KB |
Output is correct |
2 |
Correct |
621 ms |
25328 KB |
Output is correct |
3 |
Correct |
482 ms |
25296 KB |
Output is correct |
4 |
Correct |
442 ms |
13212 KB |
Output is correct |
5 |
Correct |
516 ms |
15648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
662 ms |
31592 KB |
Output is correct |
2 |
Correct |
689 ms |
32348 KB |
Output is correct |
3 |
Correct |
681 ms |
31332 KB |
Output is correct |
4 |
Correct |
520 ms |
35684 KB |
Output is correct |
5 |
Correct |
657 ms |
34780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
686 ms |
16732 KB |
Output is correct |
2 |
Correct |
812 ms |
31580 KB |
Output is correct |
3 |
Correct |
591 ms |
44100 KB |
Output is correct |
4 |
Correct |
499 ms |
35912 KB |
Output is correct |
5 |
Correct |
607 ms |
33776 KB |
Output is correct |