#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> tower[1000000];
long long n, l;
int main() {
cin >> n >> l;
for (int i = 0; i < n; i++) {
cin >> tower[i].first >> tower[i].second;
}
double low = 0;
double high = 1.5e9;
while (high - low > 1e-3) {
double mid = (low + high) / 2;
double cur = 0;
for (int i = 0; i < n; i++) {
double delta = sqrt(mid * mid - tower[i].second * tower[i].second);
double a = tower[i].first - delta;
double b = tower[i].first + delta;
if (a <= cur) {
cur = max(cur, b);
}
}
if (cur > l) {
high = mid;
} else {
low = mid;
}
}
cout << fixed;
cout << setprecision(4);
cout << low << endl;
}
# |
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 |
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 |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
224 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
6 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
1388 KB |
Output is correct |
2 |
Correct |
54 ms |
1484 KB |
Output is correct |
3 |
Correct |
36 ms |
1108 KB |
Output is correct |
4 |
Correct |
59 ms |
1560 KB |
Output is correct |
5 |
Correct |
26 ms |
1044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
1612 KB |
Output is correct |
2 |
Correct |
45 ms |
1356 KB |
Output is correct |
3 |
Correct |
56 ms |
1444 KB |
Output is correct |
4 |
Correct |
68 ms |
1504 KB |
Output is correct |
5 |
Correct |
88 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
1680 KB |
Output is correct |
2 |
Correct |
59 ms |
1532 KB |
Output is correct |
3 |
Correct |
55 ms |
1552 KB |
Output is correct |
4 |
Correct |
92 ms |
1752 KB |
Output is correct |
5 |
Correct |
56 ms |
1680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
1784 KB |
Output is correct |
2 |
Correct |
65 ms |
1820 KB |
Output is correct |
3 |
Correct |
67 ms |
1924 KB |
Output is correct |
4 |
Correct |
92 ms |
1800 KB |
Output is correct |
5 |
Correct |
68 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
1736 KB |
Output is correct |
2 |
Correct |
74 ms |
1944 KB |
Output is correct |
3 |
Correct |
56 ms |
1752 KB |
Output is correct |
4 |
Correct |
93 ms |
1888 KB |
Output is correct |
5 |
Correct |
68 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
8032 KB |
Output is correct |
2 |
Correct |
356 ms |
8220 KB |
Output is correct |
3 |
Correct |
337 ms |
8012 KB |
Output is correct |
4 |
Correct |
437 ms |
8116 KB |
Output is correct |
5 |
Correct |
396 ms |
8064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
372 ms |
8232 KB |
Output is correct |
2 |
Correct |
404 ms |
8112 KB |
Output is correct |
3 |
Correct |
312 ms |
8200 KB |
Output is correct |
4 |
Correct |
448 ms |
8236 KB |
Output is correct |
5 |
Correct |
407 ms |
8112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
332 ms |
9680 KB |
Output is correct |
2 |
Correct |
440 ms |
9676 KB |
Output is correct |
3 |
Correct |
421 ms |
9692 KB |
Output is correct |
4 |
Correct |
577 ms |
9696 KB |
Output is correct |
5 |
Correct |
447 ms |
9692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
468 ms |
9788 KB |
Output is correct |
2 |
Correct |
467 ms |
9672 KB |
Output is correct |
3 |
Correct |
369 ms |
9684 KB |
Output is correct |
4 |
Correct |
541 ms |
9676 KB |
Output is correct |
5 |
Correct |
512 ms |
9604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
370 ms |
11196 KB |
Output is correct |
2 |
Correct |
509 ms |
11256 KB |
Output is correct |
3 |
Correct |
499 ms |
11136 KB |
Output is correct |
4 |
Correct |
676 ms |
11260 KB |
Output is correct |
5 |
Correct |
485 ms |
11340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
552 ms |
11184 KB |
Output is correct |
2 |
Correct |
558 ms |
11132 KB |
Output is correct |
3 |
Correct |
468 ms |
11288 KB |
Output is correct |
4 |
Correct |
635 ms |
11184 KB |
Output is correct |
5 |
Correct |
538 ms |
11124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
410 ms |
12812 KB |
Output is correct |
2 |
Correct |
580 ms |
12804 KB |
Output is correct |
3 |
Correct |
531 ms |
12824 KB |
Output is correct |
4 |
Correct |
762 ms |
12880 KB |
Output is correct |
5 |
Correct |
598 ms |
24088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
574 ms |
12796 KB |
Output is correct |
2 |
Correct |
677 ms |
12796 KB |
Output is correct |
3 |
Correct |
497 ms |
12748 KB |
Output is correct |
4 |
Correct |
719 ms |
12772 KB |
Output is correct |
5 |
Correct |
588 ms |
24304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
530 ms |
15952 KB |
Output is correct |
2 |
Correct |
705 ms |
15988 KB |
Output is correct |
3 |
Correct |
678 ms |
30484 KB |
Output is correct |
4 |
Correct |
893 ms |
35212 KB |
Output is correct |
5 |
Correct |
741 ms |
29640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
748 ms |
15944 KB |
Output is correct |
2 |
Correct |
794 ms |
29172 KB |
Output is correct |
3 |
Correct |
616 ms |
28184 KB |
Output is correct |
4 |
Correct |
920 ms |
35292 KB |
Output is correct |
5 |
Correct |
762 ms |
30712 KB |
Output is correct |