#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 x[1000009],y[1000009],u,L,R,eps;
bool can(ld R){
ld r=0.0;
for(int i=1;i<=n;i++){
if(R>=y[i]){
ld x0=x[i]-sqrt(R*R-y[i]*y[i]);
ld x1=x[i]+sqrt(R*R-y[i]*y[i]);
if(x0<=r+eps) r=max(x1,r);
if(r>=u-eps) 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>>x[i]>>y[i];
eps=0.0001;
L=0.0; R=100000000000.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 |
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 |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
568 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
3 |
Correct |
2 ms |
476 KB |
Output is correct |
4 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
5 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 |
604 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
4 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2648 KB |
Output is correct |
2 |
Correct |
30 ms |
2648 KB |
Output is correct |
3 |
Correct |
19 ms |
2648 KB |
Output is correct |
4 |
Correct |
89 ms |
3932 KB |
Output is correct |
5 |
Correct |
33 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
2908 KB |
Output is correct |
2 |
Correct |
68 ms |
2648 KB |
Output is correct |
3 |
Correct |
83 ms |
2908 KB |
Output is correct |
4 |
Correct |
90 ms |
2940 KB |
Output is correct |
5 |
Correct |
109 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3208 KB |
Output is correct |
2 |
Correct |
31 ms |
2904 KB |
Output is correct |
3 |
Correct |
33 ms |
3932 KB |
Output is correct |
4 |
Correct |
137 ms |
5520 KB |
Output is correct |
5 |
Correct |
82 ms |
3944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
3424 KB |
Output is correct |
2 |
Correct |
45 ms |
5012 KB |
Output is correct |
3 |
Correct |
40 ms |
4572 KB |
Output is correct |
4 |
Correct |
141 ms |
5452 KB |
Output is correct |
5 |
Correct |
103 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
3600 KB |
Output is correct |
2 |
Correct |
41 ms |
3416 KB |
Output is correct |
3 |
Correct |
33 ms |
4444 KB |
Output is correct |
4 |
Correct |
154 ms |
5464 KB |
Output is correct |
5 |
Correct |
106 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
280 ms |
15956 KB |
Output is correct |
2 |
Correct |
231 ms |
23720 KB |
Output is correct |
3 |
Correct |
203 ms |
23204 KB |
Output is correct |
4 |
Correct |
685 ms |
25612 KB |
Output is correct |
5 |
Correct |
538 ms |
22872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
16212 KB |
Output is correct |
2 |
Correct |
300 ms |
22556 KB |
Output is correct |
3 |
Correct |
159 ms |
21840 KB |
Output is correct |
4 |
Correct |
676 ms |
25372 KB |
Output is correct |
5 |
Correct |
588 ms |
23408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
337 ms |
19028 KB |
Output is correct |
2 |
Correct |
243 ms |
28288 KB |
Output is correct |
3 |
Correct |
216 ms |
27800 KB |
Output is correct |
4 |
Correct |
864 ms |
31124 KB |
Output is correct |
5 |
Correct |
638 ms |
27004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
271 ms |
19240 KB |
Output is correct |
2 |
Correct |
346 ms |
26964 KB |
Output is correct |
3 |
Correct |
254 ms |
25936 KB |
Output is correct |
4 |
Correct |
790 ms |
30800 KB |
Output is correct |
5 |
Correct |
678 ms |
27728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
377 ms |
22312 KB |
Output is correct |
2 |
Correct |
267 ms |
33108 KB |
Output is correct |
3 |
Correct |
310 ms |
32340 KB |
Output is correct |
4 |
Correct |
998 ms |
35924 KB |
Output is correct |
5 |
Correct |
805 ms |
31568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
294 ms |
22352 KB |
Output is correct |
2 |
Correct |
442 ms |
31568 KB |
Output is correct |
3 |
Correct |
251 ms |
30544 KB |
Output is correct |
4 |
Execution timed out |
1056 ms |
35668 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
490 ms |
25360 KB |
Output is correct |
2 |
Correct |
333 ms |
37816 KB |
Output is correct |
3 |
Correct |
280 ms |
37096 KB |
Output is correct |
4 |
Execution timed out |
1075 ms |
41080 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
399 ms |
25428 KB |
Output is correct |
2 |
Correct |
459 ms |
35948 KB |
Output is correct |
3 |
Correct |
316 ms |
34936 KB |
Output is correct |
4 |
Execution timed out |
1052 ms |
40784 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
625 ms |
31572 KB |
Output is correct |
2 |
Correct |
384 ms |
47252 KB |
Output is correct |
3 |
Correct |
411 ms |
46164 KB |
Output is correct |
4 |
Execution timed out |
1094 ms |
50768 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
399 ms |
31572 KB |
Output is correct |
2 |
Correct |
525 ms |
44880 KB |
Output is correct |
3 |
Correct |
413 ms |
43980 KB |
Output is correct |
4 |
Execution timed out |
1060 ms |
51028 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |