// 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<double>(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 |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 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 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1448 KB |
Output is correct |
2 |
Correct |
42 ms |
1448 KB |
Output is correct |
3 |
Correct |
25 ms |
1100 KB |
Output is correct |
4 |
Correct |
48 ms |
1380 KB |
Output is correct |
5 |
Correct |
19 ms |
1080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
1532 KB |
Output is correct |
2 |
Correct |
33 ms |
1492 KB |
Output is correct |
3 |
Correct |
38 ms |
1532 KB |
Output is correct |
4 |
Correct |
41 ms |
1520 KB |
Output is correct |
5 |
Correct |
50 ms |
1584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1684 KB |
Output is correct |
2 |
Correct |
43 ms |
1548 KB |
Output is correct |
3 |
Correct |
38 ms |
1524 KB |
Output is correct |
4 |
Correct |
60 ms |
1776 KB |
Output is correct |
5 |
Correct |
40 ms |
1752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
1848 KB |
Output is correct |
2 |
Correct |
51 ms |
1800 KB |
Output is correct |
3 |
Correct |
43 ms |
1880 KB |
Output is correct |
4 |
Correct |
60 ms |
1840 KB |
Output is correct |
5 |
Correct |
47 ms |
1904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
1836 KB |
Output is correct |
2 |
Correct |
55 ms |
1828 KB |
Output is correct |
3 |
Correct |
42 ms |
1864 KB |
Output is correct |
4 |
Correct |
60 ms |
1772 KB |
Output is correct |
5 |
Correct |
51 ms |
1792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
247 ms |
8208 KB |
Output is correct |
2 |
Correct |
259 ms |
8096 KB |
Output is correct |
3 |
Correct |
255 ms |
8100 KB |
Output is correct |
4 |
Correct |
300 ms |
8216 KB |
Output is correct |
5 |
Correct |
239 ms |
8172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
289 ms |
8084 KB |
Output is correct |
2 |
Correct |
324 ms |
8140 KB |
Output is correct |
3 |
Correct |
216 ms |
8140 KB |
Output is correct |
4 |
Correct |
282 ms |
8204 KB |
Output is correct |
5 |
Correct |
247 ms |
8144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
289 ms |
9712 KB |
Output is correct |
2 |
Correct |
337 ms |
9924 KB |
Output is correct |
3 |
Correct |
316 ms |
9720 KB |
Output is correct |
4 |
Correct |
367 ms |
9608 KB |
Output is correct |
5 |
Correct |
312 ms |
9600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
371 ms |
9644 KB |
Output is correct |
2 |
Correct |
360 ms |
9712 KB |
Output is correct |
3 |
Correct |
267 ms |
9688 KB |
Output is correct |
4 |
Correct |
347 ms |
9676 KB |
Output is correct |
5 |
Correct |
292 ms |
9716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
360 ms |
11276 KB |
Output is correct |
2 |
Correct |
387 ms |
11180 KB |
Output is correct |
3 |
Correct |
368 ms |
11188 KB |
Output is correct |
4 |
Correct |
420 ms |
11248 KB |
Output is correct |
5 |
Correct |
333 ms |
11288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
403 ms |
11272 KB |
Output is correct |
2 |
Correct |
430 ms |
11396 KB |
Output is correct |
3 |
Correct |
313 ms |
11232 KB |
Output is correct |
4 |
Correct |
414 ms |
11236 KB |
Output is correct |
5 |
Correct |
340 ms |
11184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
393 ms |
12852 KB |
Output is correct |
2 |
Correct |
456 ms |
12772 KB |
Output is correct |
3 |
Correct |
436 ms |
12768 KB |
Output is correct |
4 |
Correct |
478 ms |
12956 KB |
Output is correct |
5 |
Correct |
437 ms |
12832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
463 ms |
12900 KB |
Output is correct |
2 |
Correct |
480 ms |
12836 KB |
Output is correct |
3 |
Correct |
383 ms |
12876 KB |
Output is correct |
4 |
Correct |
465 ms |
12768 KB |
Output is correct |
5 |
Correct |
430 ms |
12832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
502 ms |
16036 KB |
Output is correct |
2 |
Correct |
618 ms |
15900 KB |
Output is correct |
3 |
Correct |
531 ms |
15956 KB |
Output is correct |
4 |
Correct |
603 ms |
15868 KB |
Output is correct |
5 |
Correct |
504 ms |
15948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
642 ms |
15936 KB |
Output is correct |
2 |
Correct |
621 ms |
15896 KB |
Output is correct |
3 |
Correct |
481 ms |
16032 KB |
Output is correct |
4 |
Correct |
590 ms |
15832 KB |
Output is correct |
5 |
Correct |
508 ms |
15976 KB |
Output is correct |