#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 <= x+d){
z = x+d;
}
if(x-d < mn) mn = x-d;
if(mx < x+d) mx = x+d;
if(mn <= 0 && L <= mx && z >= L) return 1;
}
return 0;
}
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 |
1 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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 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 |
464 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 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 |
636 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
3288 KB |
Output is correct |
2 |
Correct |
19 ms |
3556 KB |
Output is correct |
3 |
Correct |
12 ms |
2012 KB |
Output is correct |
4 |
Correct |
21 ms |
3556 KB |
Output is correct |
5 |
Correct |
8 ms |
2008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
3004 KB |
Output is correct |
2 |
Correct |
14 ms |
3224 KB |
Output is correct |
3 |
Correct |
17 ms |
3284 KB |
Output is correct |
4 |
Correct |
22 ms |
3428 KB |
Output is correct |
5 |
Correct |
21 ms |
3560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
3028 KB |
Output is correct |
2 |
Correct |
18 ms |
3540 KB |
Output is correct |
3 |
Correct |
19 ms |
3356 KB |
Output is correct |
4 |
Correct |
26 ms |
3796 KB |
Output is correct |
5 |
Correct |
24 ms |
3336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
3264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
3264 KB |
Output is correct |
2 |
Correct |
22 ms |
3544 KB |
Output is correct |
3 |
Correct |
21 ms |
3288 KB |
Output is correct |
4 |
Correct |
35 ms |
3532 KB |
Output is correct |
5 |
Correct |
21 ms |
3540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
237 ms |
11776 KB |
Output is correct |
2 |
Incorrect |
121 ms |
12900 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
115 ms |
12864 KB |
Output is correct |
2 |
Correct |
241 ms |
13000 KB |
Output is correct |
3 |
Correct |
104 ms |
12932 KB |
Output is correct |
4 |
Correct |
136 ms |
13732 KB |
Output is correct |
5 |
Correct |
111 ms |
13116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
228 ms |
21424 KB |
Output is correct |
2 |
Incorrect |
152 ms |
22200 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
151 ms |
22968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
257 ms |
21768 KB |
Output is correct |
2 |
Incorrect |
162 ms |
23372 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
185 ms |
23868 KB |
Output is correct |
2 |
Correct |
299 ms |
21492 KB |
Output is correct |
3 |
Correct |
153 ms |
22196 KB |
Output is correct |
4 |
Correct |
171 ms |
23464 KB |
Output is correct |
5 |
Correct |
200 ms |
22320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
281 ms |
21176 KB |
Output is correct |
2 |
Incorrect |
191 ms |
23448 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
187 ms |
22700 KB |
Output is correct |
2 |
Correct |
353 ms |
21812 KB |
Output is correct |
3 |
Correct |
172 ms |
22708 KB |
Output is correct |
4 |
Correct |
219 ms |
27040 KB |
Output is correct |
5 |
Correct |
174 ms |
25016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
358 ms |
21600 KB |
Output is correct |
2 |
Incorrect |
238 ms |
25092 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
247 ms |
25140 KB |
Output is correct |
2 |
Correct |
401 ms |
23688 KB |
Output is correct |
3 |
Correct |
227 ms |
23352 KB |
Output is correct |
4 |
Correct |
284 ms |
26588 KB |
Output is correct |
5 |
Correct |
234 ms |
25288 KB |
Output is correct |