#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef pair<ll,pll> ppl;
ll n;
ld u,L,R,eps;
pld p[1000009];
bool can(ld R){
ld r=0.0;
for(int i=1;i<=n;i++){
if(R>=p[i].second){
ld x0=p[i].first-sqrt(R*R-p[i].second*p[i].second);
if(x0<=r) {
ld x1=p[i].first+sqrt(R*R-p[i].second*p[i].second);
r=max(x1,r);
if(r>=u) return true;
}
}
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>u;
for(int i=1;i<=n;i++) {cin>>p[i].first>>p[i].second; p[i].second=abs(p[i].second);}
eps=0.001;
L=0.0; R=1000000000.0;
while(L<R-eps){
ld mid=(L+R)*0.5;
if(can(mid)) R=mid;
else L=mid;
}
cout<<fixed<<setprecision(5)<<L;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
608 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2652 KB |
Output is correct |
2 |
Correct |
28 ms |
2648 KB |
Output is correct |
3 |
Correct |
16 ms |
2140 KB |
Output is correct |
4 |
Correct |
27 ms |
2588 KB |
Output is correct |
5 |
Correct |
14 ms |
1964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
2900 KB |
Output is correct |
2 |
Correct |
22 ms |
2648 KB |
Output is correct |
3 |
Correct |
26 ms |
2908 KB |
Output is correct |
4 |
Correct |
28 ms |
2896 KB |
Output is correct |
5 |
Correct |
32 ms |
3164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
3160 KB |
Output is correct |
2 |
Correct |
28 ms |
2904 KB |
Output is correct |
3 |
Correct |
28 ms |
2944 KB |
Output is correct |
4 |
Correct |
55 ms |
3340 KB |
Output is correct |
5 |
Correct |
37 ms |
3156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
3416 KB |
Output is correct |
2 |
Correct |
36 ms |
3420 KB |
Output is correct |
3 |
Correct |
33 ms |
3416 KB |
Output is correct |
4 |
Correct |
45 ms |
3664 KB |
Output is correct |
5 |
Correct |
35 ms |
3412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
3420 KB |
Output is correct |
2 |
Correct |
36 ms |
3524 KB |
Output is correct |
3 |
Correct |
31 ms |
3416 KB |
Output is correct |
4 |
Correct |
40 ms |
3412 KB |
Output is correct |
5 |
Correct |
32 ms |
3468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
247 ms |
15956 KB |
Output is correct |
2 |
Correct |
192 ms |
15956 KB |
Output is correct |
3 |
Correct |
168 ms |
16256 KB |
Output is correct |
4 |
Correct |
189 ms |
15952 KB |
Output is correct |
5 |
Correct |
167 ms |
16060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
218 ms |
16116 KB |
Output is correct |
2 |
Correct |
254 ms |
15956 KB |
Output is correct |
3 |
Correct |
162 ms |
15948 KB |
Output is correct |
4 |
Correct |
195 ms |
16056 KB |
Output is correct |
5 |
Correct |
181 ms |
15956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
19028 KB |
Output is correct |
2 |
Correct |
221 ms |
19228 KB |
Output is correct |
3 |
Correct |
189 ms |
19028 KB |
Output is correct |
4 |
Correct |
241 ms |
19032 KB |
Output is correct |
5 |
Correct |
213 ms |
19124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
246 ms |
19216 KB |
Output is correct |
2 |
Correct |
256 ms |
18992 KB |
Output is correct |
3 |
Correct |
179 ms |
19120 KB |
Output is correct |
4 |
Correct |
223 ms |
19108 KB |
Output is correct |
5 |
Correct |
182 ms |
19024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
22212 KB |
Output is correct |
2 |
Correct |
246 ms |
32980 KB |
Output is correct |
3 |
Correct |
227 ms |
32336 KB |
Output is correct |
4 |
Correct |
245 ms |
35664 KB |
Output is correct |
5 |
Correct |
198 ms |
31316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
22352 KB |
Output is correct |
2 |
Correct |
302 ms |
22348 KB |
Output is correct |
3 |
Correct |
211 ms |
22380 KB |
Output is correct |
4 |
Correct |
240 ms |
22224 KB |
Output is correct |
5 |
Correct |
228 ms |
22352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
365 ms |
25424 KB |
Output is correct |
2 |
Correct |
279 ms |
37716 KB |
Output is correct |
3 |
Correct |
250 ms |
37096 KB |
Output is correct |
4 |
Correct |
298 ms |
41040 KB |
Output is correct |
5 |
Correct |
239 ms |
36652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
284 ms |
25428 KB |
Output is correct |
2 |
Correct |
328 ms |
25296 KB |
Output is correct |
3 |
Correct |
263 ms |
25424 KB |
Output is correct |
4 |
Correct |
277 ms |
25400 KB |
Output is correct |
5 |
Correct |
270 ms |
25428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
474 ms |
31568 KB |
Output is correct |
2 |
Correct |
336 ms |
47184 KB |
Output is correct |
3 |
Correct |
333 ms |
46092 KB |
Output is correct |
4 |
Correct |
418 ms |
50852 KB |
Output is correct |
5 |
Correct |
307 ms |
45140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
397 ms |
31720 KB |
Output is correct |
2 |
Correct |
405 ms |
31824 KB |
Output is correct |
3 |
Correct |
314 ms |
31576 KB |
Output is correct |
4 |
Correct |
378 ms |
31572 KB |
Output is correct |
5 |
Correct |
340 ms |
31572 KB |
Output is correct |