#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
long double m;
long double x[N], y[N];
pair<long double, long double> calc(long double r, int i) {
if (r < y[i]) {
return {-1, -1};
}
return {x[i] - sqrtl(r * r - y[i] * y[i]), x[i] + sqrtl(r * r - y[i] * y[i])};
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
long double l = 2e9, r = 2e9;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> y[i];
l = min(l, abs(y[i]));
}
int iter = 60;
while (iter--) {
vector<pair<long double, long double>> segments;
long double mid = (l + r) / 2;
for (int i = 1; i <= n; ++i) {
auto x = calc(mid, i);
if (x.first != -1 && x.second != -1) {
segments.emplace_back(x.first, x.second);
}
}
sort(segments.begin(), segments.end());
long double bound = 0;
for (auto x : segments) {
if (x.first > bound) {
break;
}
bound = max(bound, x.second);
if (bound >= m) {
break;
}
}
if (bound >= m) {
r = mid;
} else {
l = mid;
}
}
cout << fixed << setprecision(6) << l << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
2820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3140 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
3076 KB |
Output is correct |
2 |
Correct |
26 ms |
3096 KB |
Output is correct |
3 |
Correct |
42 ms |
3144 KB |
Output is correct |
4 |
Incorrect |
36 ms |
3108 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
12176 KB |
Output is correct |
2 |
Correct |
647 ms |
10540 KB |
Output is correct |
3 |
Correct |
465 ms |
7144 KB |
Output is correct |
4 |
Incorrect |
689 ms |
10532 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
634 ms |
11316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
546 ms |
11328 KB |
Output is correct |
2 |
Correct |
721 ms |
12232 KB |
Output is correct |
3 |
Correct |
936 ms |
10892 KB |
Output is correct |
4 |
Incorrect |
838 ms |
12032 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
682 ms |
11920 KB |
Output is correct |
2 |
Correct |
850 ms |
11860 KB |
Output is correct |
3 |
Execution timed out |
1035 ms |
12356 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
581 ms |
11876 KB |
Output is correct |
2 |
Correct |
803 ms |
12816 KB |
Output is correct |
3 |
Execution timed out |
1070 ms |
12420 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
4176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
4236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
4176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
4184 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
4432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
4188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |