#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define pb push_back
#define endl "\n"
#define sp ' '
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
const int N = 3e5+10, OO = 1e18, mod = 1e9+7;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(int &a, int b){a = max(a,b);}
void cmn(int &a, int b){a = min(a,b);}
vector <pi> v;
int n,L;
bool cmp(const pi &a, const pi &b){
return (a.f==b.f ? abs(a.s) < abs(b.s): a.f < b.f);
}
bool ok(double m){
double mn = OO, mx = -OO, z = 0;
For(i,n){
auto [x,y] = v[i];
if(y*y > m*m) continue;
double d = sqrt(m * m - y * y);
if(x-d <= z){
z = max(z,x+d);
}
if(x-d < mn) mn = x-d;
if(mx < x+d) mx = x+d;
}
return (mn <= 0 && L <= mx && z >= L);
}
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> L;
For(i,n){
int x,y; cin >> x >> y;
v.pb({x,y});
}
sort(all(v),cmp);
double l = 0, r = 1e10;
For(i,100){
double m = (l+r)/2;
bool b = ok(m);
if(b) r = m;
else l = m;
}
cout << setprecision(10) << r << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 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 |
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 |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
608 KB |
Output is correct |
2 |
Correct |
3 ms |
744 KB |
Output is correct |
3 |
Correct |
3 ms |
608 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
3292 KB |
Output is correct |
2 |
Correct |
40 ms |
3284 KB |
Output is correct |
3 |
Correct |
29 ms |
2008 KB |
Output is correct |
4 |
Correct |
28 ms |
3284 KB |
Output is correct |
5 |
Correct |
18 ms |
2012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
3032 KB |
Output is correct |
2 |
Correct |
29 ms |
3288 KB |
Output is correct |
3 |
Correct |
32 ms |
3288 KB |
Output is correct |
4 |
Correct |
29 ms |
3288 KB |
Output is correct |
5 |
Correct |
32 ms |
3540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
3032 KB |
Output is correct |
2 |
Correct |
45 ms |
3288 KB |
Output is correct |
3 |
Correct |
41 ms |
3288 KB |
Output is correct |
4 |
Correct |
36 ms |
3788 KB |
Output is correct |
5 |
Correct |
33 ms |
3288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
3440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
3324 KB |
Output is correct |
2 |
Correct |
57 ms |
3544 KB |
Output is correct |
3 |
Correct |
46 ms |
3288 KB |
Output is correct |
4 |
Correct |
41 ms |
3788 KB |
Output is correct |
5 |
Correct |
37 ms |
3544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
258 ms |
11972 KB |
Output is correct |
2 |
Incorrect |
282 ms |
14020 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
272 ms |
13204 KB |
Output is correct |
2 |
Correct |
479 ms |
12992 KB |
Output is correct |
3 |
Correct |
238 ms |
13472 KB |
Output is correct |
4 |
Correct |
176 ms |
14784 KB |
Output is correct |
5 |
Correct |
177 ms |
14276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
316 ms |
21264 KB |
Output is correct |
2 |
Incorrect |
358 ms |
23344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
326 ms |
23220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
369 ms |
21424 KB |
Output is correct |
2 |
Incorrect |
411 ms |
23224 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
390 ms |
21876 KB |
Output is correct |
2 |
Correct |
575 ms |
22416 KB |
Output is correct |
3 |
Correct |
336 ms |
22716 KB |
Output is correct |
4 |
Correct |
253 ms |
24708 KB |
Output is correct |
5 |
Correct |
272 ms |
23708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
418 ms |
21228 KB |
Output is correct |
2 |
Incorrect |
425 ms |
23988 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
489 ms |
24512 KB |
Output is correct |
2 |
Correct |
633 ms |
23480 KB |
Output is correct |
3 |
Correct |
376 ms |
25016 KB |
Output is correct |
4 |
Correct |
290 ms |
30128 KB |
Output is correct |
5 |
Correct |
288 ms |
25016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
524 ms |
22504 KB |
Output is correct |
2 |
Incorrect |
531 ms |
25216 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
560 ms |
25060 KB |
Output is correct |
2 |
Correct |
763 ms |
24500 KB |
Output is correct |
3 |
Correct |
469 ms |
25196 KB |
Output is correct |
4 |
Correct |
382 ms |
27568 KB |
Output is correct |
5 |
Correct |
369 ms |
26036 KB |
Output is correct |