#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) 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 > 5e-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 |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
1628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
1624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
1628 KB |
Output is correct |
2 |
Correct |
18 ms |
1628 KB |
Output is correct |
3 |
Correct |
21 ms |
1800 KB |
Output is correct |
4 |
Incorrect |
19 ms |
1884 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
1880 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1880 KB |
Output is correct |
2 |
Correct |
22 ms |
1884 KB |
Output is correct |
3 |
Correct |
17 ms |
1880 KB |
Output is correct |
4 |
Incorrect |
18 ms |
1884 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
8284 KB |
Output is correct |
2 |
Incorrect |
113 ms |
8284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
122 ms |
8280 KB |
Output is correct |
2 |
Incorrect |
149 ms |
14656 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
143 ms |
9820 KB |
Output is correct |
2 |
Incorrect |
138 ms |
9820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
141 ms |
9816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
11356 KB |
Output is correct |
2 |
Incorrect |
171 ms |
11412 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
11352 KB |
Output is correct |
2 |
Incorrect |
220 ms |
20568 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
170 ms |
12968 KB |
Output is correct |
2 |
Incorrect |
180 ms |
25172 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
194 ms |
12972 KB |
Output is correct |
2 |
Incorrect |
240 ms |
23380 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
201 ms |
15960 KB |
Output is correct |
2 |
Incorrect |
244 ms |
31592 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
236 ms |
15960 KB |
Output is correct |
2 |
Incorrect |
286 ms |
29268 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |