#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;
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 |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
2 ms |
604 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 |
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 |
3 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
4 ms |
716 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
3360 KB |
Output is correct |
2 |
Correct |
29 ms |
3412 KB |
Output is correct |
3 |
Correct |
15 ms |
2656 KB |
Output is correct |
4 |
Correct |
58 ms |
3408 KB |
Output is correct |
5 |
Correct |
22 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
3420 KB |
Output is correct |
2 |
Correct |
45 ms |
3420 KB |
Output is correct |
3 |
Correct |
58 ms |
3768 KB |
Output is correct |
4 |
Correct |
62 ms |
3668 KB |
Output is correct |
5 |
Correct |
73 ms |
4192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
3716 KB |
Output is correct |
2 |
Correct |
29 ms |
3744 KB |
Output is correct |
3 |
Correct |
31 ms |
3720 KB |
Output is correct |
4 |
Correct |
92 ms |
4692 KB |
Output is correct |
5 |
Correct |
53 ms |
3916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
4444 KB |
Output is correct |
2 |
Correct |
37 ms |
4612 KB |
Output is correct |
3 |
Correct |
48 ms |
4136 KB |
Output is correct |
4 |
Correct |
92 ms |
4688 KB |
Output is correct |
5 |
Correct |
68 ms |
4176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
4604 KB |
Output is correct |
2 |
Correct |
41 ms |
4580 KB |
Output is correct |
3 |
Correct |
32 ms |
4168 KB |
Output is correct |
4 |
Correct |
114 ms |
4688 KB |
Output is correct |
5 |
Correct |
68 ms |
4176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
253 ms |
18256 KB |
Output is correct |
2 |
Correct |
191 ms |
20052 KB |
Output is correct |
3 |
Correct |
168 ms |
19880 KB |
Output is correct |
4 |
Correct |
431 ms |
21328 KB |
Output is correct |
5 |
Correct |
377 ms |
19460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
214 ms |
20292 KB |
Output is correct |
2 |
Correct |
236 ms |
19632 KB |
Output is correct |
3 |
Correct |
146 ms |
18996 KB |
Output is correct |
4 |
Correct |
405 ms |
20792 KB |
Output is correct |
5 |
Correct |
345 ms |
19864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
284 ms |
21844 KB |
Output is correct |
2 |
Correct |
207 ms |
24236 KB |
Output is correct |
3 |
Correct |
181 ms |
23692 KB |
Output is correct |
4 |
Correct |
576 ms |
25204 KB |
Output is correct |
5 |
Correct |
409 ms |
23376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
261 ms |
24148 KB |
Output is correct |
2 |
Correct |
285 ms |
23116 KB |
Output is correct |
3 |
Correct |
239 ms |
23024 KB |
Output is correct |
4 |
Correct |
602 ms |
25380 KB |
Output is correct |
5 |
Correct |
447 ms |
23632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
385 ms |
25816 KB |
Output is correct |
2 |
Correct |
288 ms |
28008 KB |
Output is correct |
3 |
Correct |
242 ms |
27556 KB |
Output is correct |
4 |
Correct |
658 ms |
29184 KB |
Output is correct |
5 |
Correct |
473 ms |
27220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
287 ms |
28244 KB |
Output is correct |
2 |
Correct |
323 ms |
27096 KB |
Output is correct |
3 |
Correct |
220 ms |
26584 KB |
Output is correct |
4 |
Correct |
688 ms |
29088 KB |
Output is correct |
5 |
Correct |
552 ms |
27532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
454 ms |
29276 KB |
Output is correct |
2 |
Correct |
324 ms |
31744 KB |
Output is correct |
3 |
Correct |
263 ms |
31596 KB |
Output is correct |
4 |
Correct |
792 ms |
33636 KB |
Output is correct |
5 |
Correct |
604 ms |
36648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
494 ms |
32412 KB |
Output is correct |
2 |
Correct |
401 ms |
31136 KB |
Output is correct |
3 |
Correct |
282 ms |
30808 KB |
Output is correct |
4 |
Correct |
934 ms |
33368 KB |
Output is correct |
5 |
Correct |
606 ms |
36868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
517 ms |
36364 KB |
Output is correct |
2 |
Correct |
398 ms |
39612 KB |
Output is correct |
3 |
Correct |
418 ms |
39004 KB |
Output is correct |
4 |
Execution timed out |
1010 ms |
41488 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
550 ms |
40204 KB |
Output is correct |
2 |
Correct |
548 ms |
38544 KB |
Output is correct |
3 |
Correct |
364 ms |
37908 KB |
Output is correct |
4 |
Execution timed out |
1020 ms |
41636 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |