#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);}
double eps = 1e-9;
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 <= x+d){
z = x+d;
}
if(x-d < mn) mn = x-d;
if(mx < x+d) mx = x+d;
}
if(z >= L){
assert(abs(z-mx) < 1);
}
return (mn <= 0 && L <= mx && z >= mx);
}
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 = 1e10;
For(i,60){
double m = (l+r)/2;
if(ok(m)) r = m;
else l = m;
}
cout << setprecision(10) << r << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
452 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 |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
832 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 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 |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
3032 KB |
Output is correct |
2 |
Correct |
27 ms |
3288 KB |
Output is correct |
3 |
Correct |
21 ms |
2012 KB |
Output is correct |
4 |
Correct |
25 ms |
3372 KB |
Output is correct |
5 |
Correct |
13 ms |
2008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
3264 KB |
Output is correct |
2 |
Correct |
21 ms |
3028 KB |
Output is correct |
3 |
Correct |
22 ms |
3288 KB |
Output is correct |
4 |
Correct |
25 ms |
3284 KB |
Output is correct |
5 |
Correct |
26 ms |
3540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
3284 KB |
Output is correct |
2 |
Correct |
34 ms |
3288 KB |
Output is correct |
3 |
Correct |
27 ms |
3032 KB |
Output is correct |
4 |
Runtime error |
24 ms |
5576 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
3468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3664 KB |
Output is correct |
2 |
Correct |
40 ms |
3408 KB |
Output is correct |
3 |
Correct |
35 ms |
3284 KB |
Output is correct |
4 |
Runtime error |
26 ms |
5576 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
173 ms |
10944 KB |
Output is correct |
2 |
Incorrect |
173 ms |
12784 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
13244 KB |
Output is correct |
2 |
Correct |
290 ms |
12216 KB |
Output is correct |
3 |
Correct |
149 ms |
11856 KB |
Output is correct |
4 |
Correct |
130 ms |
13748 KB |
Output is correct |
5 |
Runtime error |
115 ms |
20816 KB |
Execution killed with signal 6 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
208 ms |
20924 KB |
Output is correct |
2 |
Incorrect |
223 ms |
23428 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
217 ms |
22964 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
250 ms |
20928 KB |
Output is correct |
2 |
Incorrect |
275 ms |
24328 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
275 ms |
22708 KB |
Output is correct |
2 |
Correct |
332 ms |
22276 KB |
Output is correct |
3 |
Correct |
225 ms |
20920 KB |
Output is correct |
4 |
Correct |
206 ms |
23556 KB |
Output is correct |
5 |
Runtime error |
176 ms |
30120 KB |
Execution killed with signal 6 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
286 ms |
20916 KB |
Output is correct |
2 |
Incorrect |
296 ms |
22964 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
290 ms |
22452 KB |
Output is correct |
2 |
Runtime error |
250 ms |
33348 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
344 ms |
21024 KB |
Output is correct |
2 |
Incorrect |
364 ms |
24576 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
362 ms |
25180 KB |
Output is correct |
2 |
Correct |
477 ms |
23724 KB |
Output is correct |
3 |
Correct |
318 ms |
23708 KB |
Output is correct |
4 |
Correct |
282 ms |
26548 KB |
Output is correct |
5 |
Correct |
271 ms |
24540 KB |
Output is correct |