#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#define ld long double
#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(ld m){
ld mn = 2e9, mx = -2e9, z = 0;
For(i,n){
auto [x,y] = v[i];
if(y*y > m*m) continue;
ld d = sqrt(m * m - y * y);
// cout << setprecision(20) << m << sp;
// cout << y << endl;
// cout << setprecision(20) << d << endl;
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});
}
ld l = 0, r = 2236067977;
For(i,60){
ld m = (l+r)/2;
if(ok(m)) r = m;
else l = m;
}
cout << setprecision(20) << r << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
856 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
856 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
2520 KB |
Output is correct |
2 |
Correct |
24 ms |
2516 KB |
Output is correct |
3 |
Correct |
14 ms |
1500 KB |
Output is correct |
4 |
Correct |
18 ms |
2520 KB |
Output is correct |
5 |
Correct |
9 ms |
1500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
2520 KB |
Output is correct |
2 |
Correct |
18 ms |
2784 KB |
Output is correct |
3 |
Correct |
25 ms |
2520 KB |
Output is correct |
4 |
Correct |
20 ms |
2520 KB |
Output is correct |
5 |
Correct |
23 ms |
2544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
2520 KB |
Output is correct |
2 |
Correct |
25 ms |
3800 KB |
Output is correct |
3 |
Correct |
25 ms |
3544 KB |
Output is correct |
4 |
Correct |
29 ms |
4056 KB |
Output is correct |
5 |
Correct |
18 ms |
3288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
2520 KB |
Output is correct |
2 |
Correct |
33 ms |
3544 KB |
Output is correct |
3 |
Correct |
27 ms |
3288 KB |
Output is correct |
4 |
Correct |
27 ms |
4068 KB |
Output is correct |
5 |
Correct |
22 ms |
3504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
2520 KB |
Output is correct |
2 |
Correct |
31 ms |
3544 KB |
Output is correct |
3 |
Correct |
25 ms |
3664 KB |
Output is correct |
4 |
Correct |
34 ms |
4336 KB |
Output is correct |
5 |
Correct |
22 ms |
3544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
305 ms |
8908 KB |
Output is correct |
2 |
Correct |
150 ms |
16048 KB |
Output is correct |
3 |
Correct |
157 ms |
15544 KB |
Output is correct |
4 |
Correct |
128 ms |
17848 KB |
Output is correct |
5 |
Correct |
105 ms |
14996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
181 ms |
10292 KB |
Output is correct |
2 |
Correct |
315 ms |
15004 KB |
Output is correct |
3 |
Correct |
142 ms |
14008 KB |
Output is correct |
4 |
Correct |
129 ms |
17648 KB |
Output is correct |
5 |
Correct |
111 ms |
15488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
400 ms |
17340 KB |
Output is correct |
2 |
Correct |
219 ms |
27068 KB |
Output is correct |
3 |
Correct |
158 ms |
25780 KB |
Output is correct |
4 |
Correct |
152 ms |
28084 KB |
Output is correct |
5 |
Correct |
130 ms |
24500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
212 ms |
17712 KB |
Output is correct |
2 |
Correct |
397 ms |
23904 KB |
Output is correct |
3 |
Correct |
170 ms |
23476 KB |
Output is correct |
4 |
Correct |
159 ms |
27352 KB |
Output is correct |
5 |
Correct |
128 ms |
25240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
432 ms |
16996 KB |
Output is correct |
2 |
Correct |
237 ms |
26556 KB |
Output is correct |
3 |
Correct |
276 ms |
25016 KB |
Output is correct |
4 |
Correct |
195 ms |
27492 KB |
Output is correct |
5 |
Correct |
144 ms |
23732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
227 ms |
18256 KB |
Output is correct |
2 |
Correct |
413 ms |
25000 KB |
Output is correct |
3 |
Correct |
182 ms |
23476 KB |
Output is correct |
4 |
Correct |
176 ms |
27144 KB |
Output is correct |
5 |
Correct |
170 ms |
25552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
502 ms |
17396 KB |
Output is correct |
2 |
Correct |
262 ms |
26020 KB |
Output is correct |
3 |
Correct |
262 ms |
25820 KB |
Output is correct |
4 |
Correct |
214 ms |
29444 KB |
Output is correct |
5 |
Correct |
183 ms |
25308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
288 ms |
18964 KB |
Output is correct |
2 |
Correct |
430 ms |
24724 KB |
Output is correct |
3 |
Correct |
229 ms |
23732 KB |
Output is correct |
4 |
Correct |
205 ms |
29544 KB |
Output is correct |
5 |
Correct |
174 ms |
26804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
652 ms |
19344 KB |
Output is correct |
2 |
Correct |
267 ms |
31660 KB |
Output is correct |
3 |
Correct |
315 ms |
30712 KB |
Output is correct |
4 |
Correct |
260 ms |
35760 KB |
Output is correct |
5 |
Correct |
245 ms |
29612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
17280 KB |
Output is correct |
2 |
Correct |
560 ms |
29352 KB |
Output is correct |
3 |
Correct |
288 ms |
28336 KB |
Output is correct |
4 |
Correct |
272 ms |
35552 KB |
Output is correct |
5 |
Correct |
221 ms |
30920 KB |
Output is correct |