#include <bits/stdc++.h>
using namespace std;
//~ #define int long long
int n, l;
vector<pair<int, int>> points;
pair<double, double> circle_intersection(int i, double r) {
auto [x, y] = points[i];
double r2 = r*r;
double y2 = y*y;
double tmp = sqrt(r2-y2);
double x1 = x-tmp;
double x2 = x+tmp;
if (x2 < x1) swap(x1, x2);
return {x1, x2};
}
void solve() {
double ub = 1e18, lb = 0;
double m;
while (lb+0.00001 < ub) {
m = (lb+ub)/2;
double reach = 0;
bool ja = 1;
for (int i = 0; i < n; i++) {
auto [x1, x2] = circle_intersection(i, m);
if (reach+0.0000001 < x1) ja = 0;
reach = max(reach, x2);
}
if (reach+0.0000001 < l) ja = 0;
if (ja) {
ub = m;
} else {
lb = m+0.00001;
}
}
cout << ub << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> l;
cout << fixed << setprecision(6);
points = vector<pair<int, int>> (n);
for (int i = 0; i < n; i++) {
cin >> points[i].first >> points[i].second;
}
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
1628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
35 ms |
1628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
1808 KB |
Output is correct |
2 |
Incorrect |
33 ms |
2248 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
2652 KB |
Output is correct |
2 |
Incorrect |
40 ms |
2652 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
183 ms |
8020 KB |
Output is correct |
2 |
Correct |
203 ms |
10392 KB |
Output is correct |
3 |
Correct |
197 ms |
10248 KB |
Output is correct |
4 |
Incorrect |
362 ms |
12112 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
205 ms |
11044 KB |
Output is correct |
2 |
Incorrect |
317 ms |
9740 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
218 ms |
9504 KB |
Output is correct |
2 |
Incorrect |
239 ms |
12332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
248 ms |
12884 KB |
Output is correct |
2 |
Incorrect |
374 ms |
11092 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
261 ms |
10832 KB |
Output is correct |
2 |
Incorrect |
287 ms |
14160 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
15000 KB |
Output is correct |
2 |
Incorrect |
425 ms |
13352 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
298 ms |
12372 KB |
Output is correct |
2 |
Incorrect |
325 ms |
16436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
320 ms |
17236 KB |
Output is correct |
2 |
Incorrect |
489 ms |
15188 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
362 ms |
15440 KB |
Output is correct |
2 |
Incorrect |
402 ms |
20304 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
411 ms |
21252 KB |
Output is correct |
2 |
Incorrect |
578 ms |
18272 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |