// From https://usaco.guide/problems/baltic-oi-2012mobile/solution
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
pair<long long, long long> p[1000000];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, len;
cin >> n >> len;
for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;
double l = 1, r = 1.5e9;
while (r - l > 1e-3) {
double mid = (l + r) / 2, curr = 0;
for (int i = 0; i < n; i++) {
double delta = sqrt(mid * mid - p[i].y * p[i].y);
double a = p[i].x - delta, b = p[i].x + delta;
if (a <= curr) curr = max(curr, b);
}
if (curr >= len) r = mid;
else l = mid;
}
cout << fixed << setprecision(4) << l;
return 0;
}
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
404 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
352 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
444 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1504 KB |
Output is correct |
2 |
Correct |
22 ms |
1492 KB |
Output is correct |
3 |
Correct |
15 ms |
1736 KB |
Output is correct |
4 |
Correct |
26 ms |
2572 KB |
Output is correct |
5 |
Correct |
13 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1508 KB |
Output is correct |
2 |
Correct |
22 ms |
1428 KB |
Output is correct |
3 |
Correct |
27 ms |
1504 KB |
Output is correct |
4 |
Correct |
28 ms |
2636 KB |
Output is correct |
5 |
Correct |
31 ms |
3052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1620 KB |
Output is correct |
2 |
Correct |
27 ms |
1584 KB |
Output is correct |
3 |
Correct |
24 ms |
2508 KB |
Output is correct |
4 |
Correct |
50 ms |
3816 KB |
Output is correct |
5 |
Correct |
35 ms |
2728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1876 KB |
Output is correct |
2 |
Correct |
32 ms |
3256 KB |
Output is correct |
3 |
Correct |
26 ms |
2800 KB |
Output is correct |
4 |
Correct |
38 ms |
3776 KB |
Output is correct |
5 |
Correct |
32 ms |
3076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1876 KB |
Output is correct |
2 |
Correct |
30 ms |
3288 KB |
Output is correct |
3 |
Correct |
27 ms |
2908 KB |
Output is correct |
4 |
Correct |
40 ms |
3852 KB |
Output is correct |
5 |
Correct |
36 ms |
3056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
8132 KB |
Output is correct |
2 |
Correct |
156 ms |
15868 KB |
Output is correct |
3 |
Correct |
150 ms |
15372 KB |
Output is correct |
4 |
Correct |
180 ms |
17628 KB |
Output is correct |
5 |
Correct |
174 ms |
14964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
166 ms |
8068 KB |
Output is correct |
2 |
Correct |
216 ms |
14752 KB |
Output is correct |
3 |
Correct |
137 ms |
13828 KB |
Output is correct |
4 |
Correct |
214 ms |
17528 KB |
Output is correct |
5 |
Correct |
165 ms |
15444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
146 ms |
9616 KB |
Output is correct |
2 |
Correct |
198 ms |
19116 KB |
Output is correct |
3 |
Correct |
173 ms |
18396 KB |
Output is correct |
4 |
Correct |
276 ms |
21608 KB |
Output is correct |
5 |
Correct |
201 ms |
17696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
9704 KB |
Output is correct |
2 |
Correct |
308 ms |
17644 KB |
Output is correct |
3 |
Correct |
188 ms |
16544 KB |
Output is correct |
4 |
Correct |
221 ms |
21448 KB |
Output is correct |
5 |
Correct |
223 ms |
18428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
167 ms |
11368 KB |
Output is correct |
2 |
Correct |
215 ms |
22124 KB |
Output is correct |
3 |
Correct |
248 ms |
21448 KB |
Output is correct |
4 |
Correct |
261 ms |
24828 KB |
Output is correct |
5 |
Correct |
236 ms |
20300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
193 ms |
11216 KB |
Output is correct |
2 |
Correct |
293 ms |
20464 KB |
Output is correct |
3 |
Correct |
215 ms |
19616 KB |
Output is correct |
4 |
Correct |
267 ms |
24780 KB |
Output is correct |
5 |
Correct |
230 ms |
21416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
12836 KB |
Output is correct |
2 |
Correct |
240 ms |
25244 KB |
Output is correct |
3 |
Correct |
235 ms |
24476 KB |
Output is correct |
4 |
Correct |
294 ms |
28436 KB |
Output is correct |
5 |
Correct |
265 ms |
23940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
226 ms |
12808 KB |
Output is correct |
2 |
Correct |
333 ms |
23412 KB |
Output is correct |
3 |
Correct |
238 ms |
22316 KB |
Output is correct |
4 |
Correct |
293 ms |
28212 KB |
Output is correct |
5 |
Correct |
267 ms |
24368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
243 ms |
15916 KB |
Output is correct |
2 |
Correct |
319 ms |
31476 KB |
Output is correct |
3 |
Correct |
294 ms |
30532 KB |
Output is correct |
4 |
Correct |
373 ms |
35076 KB |
Output is correct |
5 |
Correct |
340 ms |
29576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
282 ms |
15900 KB |
Output is correct |
2 |
Correct |
421 ms |
29184 KB |
Output is correct |
3 |
Correct |
274 ms |
28260 KB |
Output is correct |
4 |
Correct |
378 ms |
35368 KB |
Output is correct |
5 |
Correct |
384 ms |
30708 KB |
Output is correct |