#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> tower[1000000];
long long n, l;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 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 |
340 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 |
340 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 |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
400 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
396 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1492 KB |
Output is correct |
2 |
Correct |
23 ms |
1532 KB |
Output is correct |
3 |
Correct |
14 ms |
1164 KB |
Output is correct |
4 |
Correct |
28 ms |
1436 KB |
Output is correct |
5 |
Correct |
13 ms |
1112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1552 KB |
Output is correct |
2 |
Correct |
23 ms |
1412 KB |
Output is correct |
3 |
Correct |
26 ms |
1532 KB |
Output is correct |
4 |
Correct |
33 ms |
1464 KB |
Output is correct |
5 |
Correct |
33 ms |
1680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1704 KB |
Output is correct |
2 |
Correct |
26 ms |
1612 KB |
Output is correct |
3 |
Correct |
22 ms |
1620 KB |
Output is correct |
4 |
Correct |
42 ms |
1832 KB |
Output is correct |
5 |
Correct |
27 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1880 KB |
Output is correct |
2 |
Correct |
27 ms |
1876 KB |
Output is correct |
3 |
Correct |
26 ms |
1876 KB |
Output is correct |
4 |
Correct |
44 ms |
1868 KB |
Output is correct |
5 |
Correct |
32 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1876 KB |
Output is correct |
2 |
Correct |
32 ms |
1872 KB |
Output is correct |
3 |
Correct |
28 ms |
1816 KB |
Output is correct |
4 |
Correct |
41 ms |
1872 KB |
Output is correct |
5 |
Correct |
34 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
8072 KB |
Output is correct |
2 |
Correct |
151 ms |
8136 KB |
Output is correct |
3 |
Correct |
159 ms |
8248 KB |
Output is correct |
4 |
Correct |
186 ms |
8120 KB |
Output is correct |
5 |
Correct |
167 ms |
8136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
155 ms |
8056 KB |
Output is correct |
2 |
Correct |
212 ms |
8132 KB |
Output is correct |
3 |
Correct |
131 ms |
8100 KB |
Output is correct |
4 |
Correct |
187 ms |
8012 KB |
Output is correct |
5 |
Correct |
169 ms |
8136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
9580 KB |
Output is correct |
2 |
Correct |
166 ms |
9620 KB |
Output is correct |
3 |
Correct |
182 ms |
9644 KB |
Output is correct |
4 |
Correct |
270 ms |
9600 KB |
Output is correct |
5 |
Correct |
194 ms |
9704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
9672 KB |
Output is correct |
2 |
Correct |
252 ms |
9704 KB |
Output is correct |
3 |
Correct |
156 ms |
9704 KB |
Output is correct |
4 |
Correct |
231 ms |
9588 KB |
Output is correct |
5 |
Correct |
207 ms |
9716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
200 ms |
11256 KB |
Output is correct |
2 |
Correct |
200 ms |
11268 KB |
Output is correct |
3 |
Correct |
194 ms |
11176 KB |
Output is correct |
4 |
Correct |
270 ms |
11208 KB |
Output is correct |
5 |
Correct |
229 ms |
11328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
211 ms |
11264 KB |
Output is correct |
2 |
Correct |
291 ms |
11264 KB |
Output is correct |
3 |
Correct |
190 ms |
11156 KB |
Output is correct |
4 |
Correct |
262 ms |
11272 KB |
Output is correct |
5 |
Correct |
232 ms |
11272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
193 ms |
12772 KB |
Output is correct |
2 |
Correct |
232 ms |
12804 KB |
Output is correct |
3 |
Correct |
219 ms |
12752 KB |
Output is correct |
4 |
Correct |
322 ms |
12908 KB |
Output is correct |
5 |
Correct |
266 ms |
12888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
12836 KB |
Output is correct |
2 |
Correct |
318 ms |
12840 KB |
Output is correct |
3 |
Correct |
213 ms |
12716 KB |
Output is correct |
4 |
Correct |
331 ms |
12836 KB |
Output is correct |
5 |
Correct |
267 ms |
12836 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
15952 KB |
Output is correct |
2 |
Correct |
288 ms |
15952 KB |
Output is correct |
3 |
Correct |
300 ms |
15952 KB |
Output is correct |
4 |
Correct |
400 ms |
15948 KB |
Output is correct |
5 |
Correct |
335 ms |
15856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
288 ms |
15948 KB |
Output is correct |
2 |
Correct |
408 ms |
15932 KB |
Output is correct |
3 |
Correct |
281 ms |
16032 KB |
Output is correct |
4 |
Correct |
429 ms |
15956 KB |
Output is correct |
5 |
Correct |
344 ms |
15952 KB |
Output is correct |