#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;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
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;
}
Compilation message
mobile.cpp:11: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
11 | #pragma comment(linker, "/stack:200000000")
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
476 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 |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
704 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
5 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
588 KB |
Output is correct |
4 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
604 KB |
Output is correct |
2 |
Correct |
6 ms |
696 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
3 ms |
480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
3420 KB |
Output is correct |
2 |
Correct |
74 ms |
3920 KB |
Output is correct |
3 |
Correct |
40 ms |
2648 KB |
Output is correct |
4 |
Correct |
61 ms |
3984 KB |
Output is correct |
5 |
Correct |
22 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
3416 KB |
Output is correct |
2 |
Correct |
62 ms |
3408 KB |
Output is correct |
3 |
Correct |
56 ms |
3900 KB |
Output is correct |
4 |
Correct |
68 ms |
3924 KB |
Output is correct |
5 |
Correct |
77 ms |
4580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
118 ms |
3672 KB |
Output is correct |
2 |
Correct |
77 ms |
4180 KB |
Output is correct |
3 |
Correct |
36 ms |
3924 KB |
Output is correct |
4 |
Correct |
90 ms |
5508 KB |
Output is correct |
5 |
Correct |
51 ms |
3924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
4944 KB |
Output is correct |
2 |
Correct |
62 ms |
4956 KB |
Output is correct |
3 |
Correct |
46 ms |
4612 KB |
Output is correct |
4 |
Correct |
90 ms |
5456 KB |
Output is correct |
5 |
Correct |
70 ms |
4840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
158 ms |
4944 KB |
Output is correct |
2 |
Correct |
61 ms |
4944 KB |
Output is correct |
3 |
Correct |
46 ms |
4436 KB |
Output is correct |
4 |
Correct |
94 ms |
5456 KB |
Output is correct |
5 |
Correct |
67 ms |
4688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
771 ms |
19836 KB |
Output is correct |
2 |
Correct |
304 ms |
22488 KB |
Output is correct |
3 |
Correct |
214 ms |
22100 KB |
Output is correct |
4 |
Correct |
488 ms |
24048 KB |
Output is correct |
5 |
Correct |
372 ms |
21844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
448 ms |
22868 KB |
Output is correct |
2 |
Correct |
565 ms |
21716 KB |
Output is correct |
3 |
Correct |
263 ms |
20916 KB |
Output is correct |
4 |
Correct |
460 ms |
23888 KB |
Output is correct |
5 |
Correct |
362 ms |
23136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
987 ms |
24408 KB |
Output is correct |
2 |
Correct |
350 ms |
27988 KB |
Output is correct |
3 |
Correct |
246 ms |
27440 KB |
Output is correct |
4 |
Correct |
538 ms |
30148 KB |
Output is correct |
5 |
Correct |
395 ms |
26704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
444 ms |
28716 KB |
Output is correct |
2 |
Correct |
586 ms |
26540 KB |
Output is correct |
3 |
Correct |
273 ms |
25940 KB |
Output is correct |
4 |
Correct |
546 ms |
30036 KB |
Output is correct |
5 |
Correct |
487 ms |
27472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1036 ms |
28244 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
483 ms |
32912 KB |
Output is correct |
2 |
Correct |
754 ms |
31328 KB |
Output is correct |
3 |
Correct |
335 ms |
30276 KB |
Output is correct |
4 |
Correct |
599 ms |
34916 KB |
Output is correct |
5 |
Correct |
543 ms |
31936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
31988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
585 ms |
37552 KB |
Output is correct |
2 |
Correct |
811 ms |
35696 KB |
Output is correct |
3 |
Correct |
348 ms |
34896 KB |
Output is correct |
4 |
Correct |
757 ms |
39764 KB |
Output is correct |
5 |
Correct |
570 ms |
36176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1051 ms |
39752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
758 ms |
46672 KB |
Output is correct |
2 |
Execution timed out |
1055 ms |
43968 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |