#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
int N;
ll L;
cin >> N >> L;
vector<ll> X(N);
vector<ll> Y(N);
for (int i=0;i<N;i++) cin >> X[i] >> Y[i];
auto get_hw = [&](double y, double r) {
if (abs(y) > r) return -1.0;
return sqrt((r-y) * (r+y));
};
auto can_do = [&](double R) {
double progress = 0.;
for (int i=0;i<N;i++) {
double hw = get_hw((double)Y[i], R);
if (hw < 0) continue;
double l = (double)X[i] - hw;
double r = (double)X[i] + hw;
if (l <= progress + 1e-6) progress = r;
if (progress >= (double)L) return true;
}
return false;
};
double lo = 0;
ll lhi = L + abs(X[0]) + abs(Y[0]);
lhi = lhi*lhi;
for (int i=0;i<N;i++) {
ll nhi = max(
X[i]*X[i] + Y[i]*Y[i],
(X[i]-L)*(X[i]-L) + Y[i]*Y[i]
);
lhi = min(nhi, lhi);
}
double hi = sqrt(lhi);
while (hi - lo > 1e-4) {
double mid = (lo + hi) / 2;
if (can_do(mid)) hi = mid;
else lo = mid;
}
cout << setprecision(10);
cout << lo << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
464 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
464 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
2 ms |
556 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2404 KB |
Output is correct |
2 |
Correct |
21 ms |
2908 KB |
Output is correct |
3 |
Correct |
17 ms |
2652 KB |
Output is correct |
4 |
Incorrect |
21 ms |
3932 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
3432 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3416 KB |
Output is correct |
2 |
Correct |
23 ms |
3420 KB |
Output is correct |
3 |
Correct |
17 ms |
2908 KB |
Output is correct |
4 |
Incorrect |
22 ms |
3812 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
117 ms |
12372 KB |
Output is correct |
2 |
Incorrect |
122 ms |
15968 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
125 ms |
16468 KB |
Output is correct |
2 |
Incorrect |
156 ms |
14676 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
132 ms |
14928 KB |
Output is correct |
2 |
Incorrect |
144 ms |
18912 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
156 ms |
19696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
167 ms |
17236 KB |
Output is correct |
2 |
Incorrect |
175 ms |
22096 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
177 ms |
22784 KB |
Output is correct |
2 |
Incorrect |
231 ms |
20612 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
173 ms |
19792 KB |
Output is correct |
2 |
Incorrect |
185 ms |
25260 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
200 ms |
26028 KB |
Output is correct |
2 |
Incorrect |
248 ms |
23336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
225 ms |
24660 KB |
Output is correct |
2 |
Incorrect |
256 ms |
31452 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
252 ms |
32596 KB |
Output is correct |
2 |
Incorrect |
292 ms |
29420 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |