#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=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 |
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 |
0 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 |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
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 |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
600 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 |
644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
600 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
5 |
Correct |
4 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2652 KB |
Output is correct |
2 |
Correct |
31 ms |
2696 KB |
Output is correct |
3 |
Correct |
17 ms |
2136 KB |
Output is correct |
4 |
Correct |
112 ms |
2640 KB |
Output is correct |
5 |
Correct |
33 ms |
1840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
2908 KB |
Output is correct |
2 |
Correct |
69 ms |
2672 KB |
Output is correct |
3 |
Correct |
81 ms |
3004 KB |
Output is correct |
4 |
Correct |
99 ms |
2812 KB |
Output is correct |
5 |
Correct |
109 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
3160 KB |
Output is correct |
2 |
Correct |
31 ms |
2968 KB |
Output is correct |
3 |
Correct |
28 ms |
2904 KB |
Output is correct |
4 |
Correct |
131 ms |
3576 KB |
Output is correct |
5 |
Correct |
80 ms |
3248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
3464 KB |
Output is correct |
2 |
Correct |
36 ms |
3424 KB |
Output is correct |
3 |
Correct |
30 ms |
3420 KB |
Output is correct |
4 |
Correct |
136 ms |
3596 KB |
Output is correct |
5 |
Correct |
103 ms |
3412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
3416 KB |
Output is correct |
2 |
Correct |
40 ms |
3408 KB |
Output is correct |
3 |
Correct |
32 ms |
3420 KB |
Output is correct |
4 |
Correct |
157 ms |
3512 KB |
Output is correct |
5 |
Correct |
106 ms |
3420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
15956 KB |
Output is correct |
2 |
Correct |
187 ms |
15956 KB |
Output is correct |
3 |
Correct |
166 ms |
15956 KB |
Output is correct |
4 |
Correct |
603 ms |
15956 KB |
Output is correct |
5 |
Correct |
480 ms |
15956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
228 ms |
15960 KB |
Output is correct |
2 |
Correct |
254 ms |
16124 KB |
Output is correct |
3 |
Correct |
161 ms |
15952 KB |
Output is correct |
4 |
Correct |
641 ms |
16176 KB |
Output is correct |
5 |
Correct |
534 ms |
15956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
332 ms |
19024 KB |
Output is correct |
2 |
Correct |
243 ms |
19024 KB |
Output is correct |
3 |
Correct |
210 ms |
19216 KB |
Output is correct |
4 |
Correct |
871 ms |
19024 KB |
Output is correct |
5 |
Correct |
625 ms |
19256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
321 ms |
19024 KB |
Output is correct |
2 |
Correct |
327 ms |
19216 KB |
Output is correct |
3 |
Correct |
227 ms |
19280 KB |
Output is correct |
4 |
Correct |
840 ms |
19072 KB |
Output is correct |
5 |
Correct |
708 ms |
19024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
396 ms |
22352 KB |
Output is correct |
2 |
Correct |
315 ms |
22352 KB |
Output is correct |
3 |
Correct |
311 ms |
22356 KB |
Output is correct |
4 |
Execution timed out |
1022 ms |
22352 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
323 ms |
22356 KB |
Output is correct |
2 |
Correct |
328 ms |
22352 KB |
Output is correct |
3 |
Correct |
259 ms |
22356 KB |
Output is correct |
4 |
Correct |
980 ms |
22380 KB |
Output is correct |
5 |
Correct |
834 ms |
22356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
466 ms |
25424 KB |
Output is correct |
2 |
Correct |
344 ms |
25376 KB |
Output is correct |
3 |
Correct |
282 ms |
25424 KB |
Output is correct |
4 |
Execution timed out |
1059 ms |
25348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
366 ms |
25516 KB |
Output is correct |
2 |
Correct |
400 ms |
25424 KB |
Output is correct |
3 |
Correct |
276 ms |
25424 KB |
Output is correct |
4 |
Execution timed out |
1072 ms |
25464 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
557 ms |
31532 KB |
Output is correct |
2 |
Correct |
438 ms |
31824 KB |
Output is correct |
3 |
Correct |
383 ms |
31568 KB |
Output is correct |
4 |
Execution timed out |
1029 ms |
31596 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
487 ms |
31612 KB |
Output is correct |
2 |
Correct |
467 ms |
31656 KB |
Output is correct |
3 |
Correct |
378 ms |
31688 KB |
Output is correct |
4 |
Execution timed out |
1055 ms |
31680 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |