#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 = max(progress, r);
if (progress >= (double)L) return true;
}
return false;
};
double lo = 0;
double hi = L + abs(X[0]) + abs(Y[0]);
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 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
576 KB |
Output is correct |
4 |
Correct |
1 ms |
608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2396 KB |
Output is correct |
2 |
Correct |
14 ms |
2652 KB |
Output is correct |
3 |
Correct |
9 ms |
1884 KB |
Output is correct |
4 |
Correct |
15 ms |
2652 KB |
Output is correct |
5 |
Correct |
6 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
2396 KB |
Output is correct |
2 |
Correct |
11 ms |
2152 KB |
Output is correct |
3 |
Correct |
13 ms |
2652 KB |
Output is correct |
4 |
Correct |
15 ms |
2908 KB |
Output is correct |
5 |
Correct |
16 ms |
3284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
2396 KB |
Output is correct |
2 |
Correct |
15 ms |
2908 KB |
Output is correct |
3 |
Correct |
12 ms |
2652 KB |
Output is correct |
4 |
Correct |
20 ms |
3972 KB |
Output is correct |
5 |
Correct |
13 ms |
2648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
3420 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
3564 KB |
Output is correct |
2 |
Correct |
23 ms |
3416 KB |
Output is correct |
3 |
Correct |
16 ms |
2908 KB |
Output is correct |
4 |
Correct |
22 ms |
3940 KB |
Output is correct |
5 |
Correct |
18 ms |
3304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
117 ms |
12368 KB |
Output is correct |
2 |
Incorrect |
94 ms |
15828 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
109 ms |
16464 KB |
Output is correct |
2 |
Correct |
171 ms |
14784 KB |
Output is correct |
3 |
Correct |
81 ms |
13904 KB |
Output is correct |
4 |
Correct |
96 ms |
17492 KB |
Output is correct |
5 |
Correct |
82 ms |
15436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
131 ms |
15184 KB |
Output is correct |
2 |
Incorrect |
125 ms |
19024 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
128 ms |
19540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
17232 KB |
Output is correct |
2 |
Incorrect |
141 ms |
22352 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
159 ms |
22552 KB |
Output is correct |
2 |
Correct |
218 ms |
20564 KB |
Output is correct |
3 |
Correct |
103 ms |
19596 KB |
Output is correct |
4 |
Correct |
176 ms |
24588 KB |
Output is correct |
5 |
Correct |
120 ms |
21328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
189 ms |
19900 KB |
Output is correct |
2 |
Incorrect |
156 ms |
25168 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
173 ms |
25940 KB |
Output is correct |
2 |
Correct |
231 ms |
23324 KB |
Output is correct |
3 |
Correct |
123 ms |
22352 KB |
Output is correct |
4 |
Correct |
160 ms |
28200 KB |
Output is correct |
5 |
Correct |
140 ms |
24364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
219 ms |
24660 KB |
Output is correct |
2 |
Incorrect |
217 ms |
31572 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
224 ms |
32356 KB |
Output is correct |
2 |
Correct |
283 ms |
29264 KB |
Output is correct |
3 |
Correct |
165 ms |
28248 KB |
Output is correct |
4 |
Correct |
205 ms |
35168 KB |
Output is correct |
5 |
Correct |
165 ms |
30800 KB |
Output is correct |