// https://oj.uz/problem/view/BOI12_mobile
#include <bits/stdc++.h>
using namespace std;
#define EPS 0.001
#define maxN 1000000
int n, l;
double X[maxN];
double Y[maxN];
bool ok(double radius) {
double range = 0;
for (int i = 0; i < n; i++) {
double term = (radius * radius) - (Y[i] * Y[i]);
if (term >= 0) {
double term_sqrt = sqrt(term);
double range_l = X[i] - term_sqrt;
double range_r = X[i] + term_sqrt;
if (range_l <= range) {
range = max(range, range_r);
}
}
if (range >= l) {
return false;
}
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> l;
for (int i = 0; i < n; i++) {
cin >> X[i] >> Y[i];
}
double lo = 0, hi = l;
while (lo + EPS < hi) {
double mid = (lo + hi) / 2;
if (!ok(mid)) {
hi = mid;
}
else {
lo = mid;
}
}
cout << fixed << setprecision(4) << lo << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1492 KB |
Output is correct |
2 |
Correct |
41 ms |
1432 KB |
Output is correct |
3 |
Correct |
24 ms |
1108 KB |
Output is correct |
4 |
Correct |
40 ms |
1496 KB |
Output is correct |
5 |
Correct |
22 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
1520 KB |
Output is correct |
2 |
Correct |
34 ms |
1468 KB |
Output is correct |
3 |
Correct |
38 ms |
1564 KB |
Output is correct |
4 |
Correct |
41 ms |
1544 KB |
Output is correct |
5 |
Correct |
48 ms |
1564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
1588 KB |
Output is correct |
2 |
Correct |
43 ms |
1612 KB |
Output is correct |
3 |
Correct |
37 ms |
1560 KB |
Output is correct |
4 |
Correct |
60 ms |
1824 KB |
Output is correct |
5 |
Correct |
38 ms |
1700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
1868 KB |
Output is correct |
2 |
Correct |
51 ms |
1816 KB |
Output is correct |
3 |
Correct |
44 ms |
1884 KB |
Output is correct |
4 |
Correct |
69 ms |
1872 KB |
Output is correct |
5 |
Correct |
49 ms |
1868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
1824 KB |
Output is correct |
2 |
Correct |
52 ms |
1868 KB |
Output is correct |
3 |
Correct |
44 ms |
1868 KB |
Output is correct |
4 |
Correct |
62 ms |
1804 KB |
Output is correct |
5 |
Correct |
49 ms |
1880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
237 ms |
8144 KB |
Output is correct |
2 |
Correct |
281 ms |
8188 KB |
Output is correct |
3 |
Correct |
253 ms |
8060 KB |
Output is correct |
4 |
Correct |
296 ms |
8040 KB |
Output is correct |
5 |
Correct |
237 ms |
8072 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
293 ms |
8072 KB |
Output is correct |
2 |
Correct |
305 ms |
8144 KB |
Output is correct |
3 |
Correct |
221 ms |
8136 KB |
Output is correct |
4 |
Correct |
284 ms |
8088 KB |
Output is correct |
5 |
Correct |
257 ms |
8144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
286 ms |
9712 KB |
Output is correct |
2 |
Correct |
336 ms |
9660 KB |
Output is correct |
3 |
Correct |
316 ms |
9692 KB |
Output is correct |
4 |
Correct |
359 ms |
9704 KB |
Output is correct |
5 |
Correct |
288 ms |
9628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
352 ms |
9612 KB |
Output is correct |
2 |
Correct |
361 ms |
9604 KB |
Output is correct |
3 |
Correct |
272 ms |
9656 KB |
Output is correct |
4 |
Correct |
346 ms |
9608 KB |
Output is correct |
5 |
Correct |
293 ms |
9648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
331 ms |
11280 KB |
Output is correct |
2 |
Correct |
373 ms |
11280 KB |
Output is correct |
3 |
Correct |
361 ms |
11324 KB |
Output is correct |
4 |
Correct |
409 ms |
11360 KB |
Output is correct |
5 |
Correct |
352 ms |
11180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
391 ms |
11268 KB |
Output is correct |
2 |
Correct |
422 ms |
11372 KB |
Output is correct |
3 |
Correct |
312 ms |
11156 KB |
Output is correct |
4 |
Correct |
399 ms |
11340 KB |
Output is correct |
5 |
Correct |
348 ms |
11180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
390 ms |
12836 KB |
Output is correct |
2 |
Correct |
424 ms |
12892 KB |
Output is correct |
3 |
Correct |
430 ms |
12748 KB |
Output is correct |
4 |
Correct |
477 ms |
12732 KB |
Output is correct |
5 |
Correct |
394 ms |
12748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
466 ms |
12800 KB |
Output is correct |
2 |
Correct |
490 ms |
12748 KB |
Output is correct |
3 |
Correct |
354 ms |
12908 KB |
Output is correct |
4 |
Correct |
477 ms |
12956 KB |
Output is correct |
5 |
Correct |
388 ms |
12832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
473 ms |
15948 KB |
Output is correct |
2 |
Correct |
542 ms |
15956 KB |
Output is correct |
3 |
Correct |
525 ms |
15924 KB |
Output is correct |
4 |
Correct |
595 ms |
15872 KB |
Output is correct |
5 |
Correct |
480 ms |
15932 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
573 ms |
16056 KB |
Output is correct |
2 |
Correct |
580 ms |
15960 KB |
Output is correct |
3 |
Correct |
482 ms |
15884 KB |
Output is correct |
4 |
Correct |
587 ms |
16072 KB |
Output is correct |
5 |
Correct |
512 ms |
15836 KB |
Output is correct |