#include <bits/stdc++.h>
using namespace std;
void solve()
{
struct point
{
int 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 = 1e15;
for (double lo = 1.0; ans - lo > 1e-6;)
{
if (double mid = (lo + ans) / 2.0; valid(mid))
ans = mid;
else
lo = mid + 1e-5;
}
cout << fixed << setprecision(5) << ans << '\n';
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(NULL);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
440 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
5 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
572 KB |
Output is correct |
2 |
Correct |
15 ms |
572 KB |
Output is correct |
3 |
Correct |
17 ms |
556 KB |
Output is correct |
4 |
Incorrect |
14 ms |
576 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
556 KB |
Output is correct |
2 |
Correct |
14 ms |
556 KB |
Output is correct |
3 |
Correct |
17 ms |
716 KB |
Output is correct |
4 |
Incorrect |
13 ms |
572 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
796 KB |
Output is correct |
2 |
Correct |
14 ms |
568 KB |
Output is correct |
3 |
Correct |
19 ms |
556 KB |
Output is correct |
4 |
Incorrect |
13 ms |
568 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
225 ms |
4184 KB |
Output is correct |
2 |
Incorrect |
346 ms |
4332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
4244 KB |
Output is correct |
2 |
Correct |
192 ms |
4064 KB |
Output is correct |
3 |
Incorrect |
298 ms |
4316 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
324 ms |
4520 KB |
Output is correct |
2 |
Incorrect |
456 ms |
4348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
399 ms |
5008 KB |
Output is correct |
2 |
Incorrect |
541 ms |
4752 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
353 ms |
4856 KB |
Output is correct |
2 |
Incorrect |
505 ms |
4776 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1087 ms |
20380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1055 ms |
20292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1077 ms |
30868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
30864 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1086 ms |
33308 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1079 ms |
33348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1096 ms |
35800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1098 ms |
35688 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1087 ms |
40252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1093 ms |
40264 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |