#include <bits/stdc++.h>
#define p pair<long long,long long>
using namespace std;
bool Check(double d,vector<p> v,int n,int l) {
double curr=0;
for (int i=0; i<n; i++) {
double x=v[i].first,y=v[i].second;
double distance=sqrt(d*d-y*y);
double st=x-distance,dr=x+distance;
if (st<=curr) curr=max(curr,dr);
}
return (curr>=l);
}
int main()
{
int n,l;
cin>>n>>l;
vector< p > v(n);
for (int i=0; i<n; i++)
cin>>v[i].first>>v[i].second;
double st=0,dr=1.5e9,mij;
while (dr-st>1e-3) {
mij=(st+dr)/2;
//cout<<st<<' '<<dr<<' '<<mij<<'\n';
if (Check(mij,v,n,l)) dr=mij;
else st=mij;
}
cout<<fixed<<setprecision(4)<<dr<<'\n';
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 |
1 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
476 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 |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
3 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 |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
548 KB |
Output is correct |
4 |
Correct |
4 ms |
436 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 |
604 KB |
Output is correct |
4 |
Correct |
4 ms |
444 KB |
Output is correct |
5 |
Correct |
3 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
3520 KB |
Output is correct |
2 |
Correct |
47 ms |
3880 KB |
Output is correct |
3 |
Correct |
29 ms |
2640 KB |
Output is correct |
4 |
Correct |
58 ms |
3920 KB |
Output is correct |
5 |
Correct |
24 ms |
2364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3620 KB |
Output is correct |
2 |
Correct |
61 ms |
3408 KB |
Output is correct |
3 |
Correct |
50 ms |
3748 KB |
Output is correct |
4 |
Correct |
54 ms |
3960 KB |
Output is correct |
5 |
Correct |
79 ms |
4588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
3828 KB |
Output is correct |
2 |
Correct |
49 ms |
3924 KB |
Output is correct |
3 |
Correct |
49 ms |
3924 KB |
Output is correct |
4 |
Correct |
81 ms |
5296 KB |
Output is correct |
5 |
Correct |
51 ms |
4072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
4948 KB |
Output is correct |
2 |
Correct |
64 ms |
4908 KB |
Output is correct |
3 |
Correct |
52 ms |
4444 KB |
Output is correct |
4 |
Correct |
80 ms |
5176 KB |
Output is correct |
5 |
Correct |
61 ms |
4692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
4944 KB |
Output is correct |
2 |
Correct |
67 ms |
4820 KB |
Output is correct |
3 |
Correct |
58 ms |
4528 KB |
Output is correct |
4 |
Correct |
78 ms |
5312 KB |
Output is correct |
5 |
Correct |
62 ms |
4688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
243 ms |
19740 KB |
Output is correct |
2 |
Correct |
306 ms |
22628 KB |
Output is correct |
3 |
Correct |
387 ms |
22220 KB |
Output is correct |
4 |
Correct |
389 ms |
24268 KB |
Output is correct |
5 |
Correct |
327 ms |
21452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
339 ms |
22988 KB |
Output is correct |
2 |
Correct |
391 ms |
21844 KB |
Output is correct |
3 |
Correct |
271 ms |
20680 KB |
Output is correct |
4 |
Correct |
372 ms |
23476 KB |
Output is correct |
5 |
Correct |
330 ms |
21960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
309 ms |
23764 KB |
Output is correct |
2 |
Correct |
381 ms |
27128 KB |
Output is correct |
3 |
Correct |
371 ms |
26032 KB |
Output is correct |
4 |
Correct |
534 ms |
28344 KB |
Output is correct |
5 |
Correct |
387 ms |
25520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
403 ms |
27740 KB |
Output is correct |
2 |
Correct |
430 ms |
25776 KB |
Output is correct |
3 |
Correct |
331 ms |
24500 KB |
Output is correct |
4 |
Correct |
470 ms |
28340 KB |
Output is correct |
5 |
Correct |
548 ms |
26116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
370 ms |
28472 KB |
Output is correct |
2 |
Correct |
441 ms |
32596 KB |
Output is correct |
3 |
Correct |
437 ms |
31416 KB |
Output is correct |
4 |
Correct |
565 ms |
34712 KB |
Output is correct |
5 |
Correct |
456 ms |
30608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
463 ms |
33276 KB |
Output is correct |
2 |
Correct |
513 ms |
31232 KB |
Output is correct |
3 |
Correct |
403 ms |
29864 KB |
Output is correct |
4 |
Correct |
545 ms |
34600 KB |
Output is correct |
5 |
Correct |
477 ms |
30104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
413 ms |
31352 KB |
Output is correct |
2 |
Correct |
526 ms |
35848 KB |
Output is correct |
3 |
Correct |
496 ms |
34680 KB |
Output is correct |
4 |
Correct |
668 ms |
37760 KB |
Output is correct |
5 |
Correct |
537 ms |
34092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
539 ms |
36348 KB |
Output is correct |
2 |
Correct |
573 ms |
34080 KB |
Output is correct |
3 |
Correct |
464 ms |
33148 KB |
Output is correct |
4 |
Correct |
648 ms |
37460 KB |
Output is correct |
5 |
Correct |
570 ms |
34684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
533 ms |
38848 KB |
Output is correct |
2 |
Correct |
637 ms |
44276 KB |
Output is correct |
3 |
Correct |
624 ms |
43156 KB |
Output is correct |
4 |
Correct |
807 ms |
48716 KB |
Output is correct |
5 |
Correct |
655 ms |
45400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
656 ms |
47184 KB |
Output is correct |
2 |
Correct |
708 ms |
43852 KB |
Output is correct |
3 |
Correct |
581 ms |
42580 KB |
Output is correct |
4 |
Correct |
778 ms |
46536 KB |
Output is correct |
5 |
Correct |
679 ms |
46292 KB |
Output is correct |