#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 ok(double m){
double mn = 2e9, mx = -2e9, 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});
}
double l = 0, r = 3e9;
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 |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
456 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 |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
2 ms |
348 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 |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
604 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 |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
2 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 |
664 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
600 KB |
Output is correct |
5 |
Correct |
2 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
3540 KB |
Output is correct |
2 |
Correct |
36 ms |
3540 KB |
Output is correct |
3 |
Correct |
22 ms |
2008 KB |
Output is correct |
4 |
Correct |
24 ms |
3540 KB |
Output is correct |
5 |
Correct |
16 ms |
2012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
3032 KB |
Output is correct |
2 |
Correct |
23 ms |
3288 KB |
Output is correct |
3 |
Correct |
29 ms |
3544 KB |
Output is correct |
4 |
Correct |
25 ms |
3544 KB |
Output is correct |
5 |
Correct |
27 ms |
3544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
3032 KB |
Output is correct |
2 |
Correct |
40 ms |
3540 KB |
Output is correct |
3 |
Correct |
34 ms |
3284 KB |
Output is correct |
4 |
Correct |
34 ms |
3796 KB |
Output is correct |
5 |
Correct |
28 ms |
3284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
3380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
3284 KB |
Output is correct |
2 |
Correct |
48 ms |
3544 KB |
Output is correct |
3 |
Correct |
41 ms |
3540 KB |
Output is correct |
4 |
Correct |
36 ms |
3792 KB |
Output is correct |
5 |
Correct |
32 ms |
3288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
230 ms |
11676 KB |
Output is correct |
2 |
Incorrect |
252 ms |
13864 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
243 ms |
13236 KB |
Output is correct |
2 |
Correct |
462 ms |
13008 KB |
Output is correct |
3 |
Correct |
202 ms |
12484 KB |
Output is correct |
4 |
Correct |
149 ms |
13548 KB |
Output is correct |
5 |
Correct |
148 ms |
14004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
282 ms |
20148 KB |
Output is correct |
2 |
Incorrect |
303 ms |
23500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
282 ms |
22964 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
21444 KB |
Output is correct |
2 |
Incorrect |
330 ms |
23932 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
333 ms |
23480 KB |
Output is correct |
2 |
Correct |
558 ms |
23224 KB |
Output is correct |
3 |
Correct |
278 ms |
21172 KB |
Output is correct |
4 |
Correct |
212 ms |
23904 KB |
Output is correct |
5 |
Correct |
219 ms |
22800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
382 ms |
20512 KB |
Output is correct |
2 |
Incorrect |
372 ms |
23220 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
403 ms |
24500 KB |
Output is correct |
2 |
Correct |
613 ms |
23220 KB |
Output is correct |
3 |
Correct |
320 ms |
21172 KB |
Output is correct |
4 |
Correct |
263 ms |
23988 KB |
Output is correct |
5 |
Correct |
235 ms |
21944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
474 ms |
22204 KB |
Output is correct |
2 |
Incorrect |
470 ms |
25652 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
498 ms |
25536 KB |
Output is correct |
2 |
Correct |
758 ms |
23212 KB |
Output is correct |
3 |
Correct |
399 ms |
22864 KB |
Output is correct |
4 |
Correct |
311 ms |
26252 KB |
Output is correct |
5 |
Correct |
301 ms |
24756 KB |
Output is correct |