#include <bits/stdc++.h>
using namespace std;
#define ll long long
double dist(double k, ll y){
return sqrt(k*k - y*y);
}
bool check(ll n, double k, ll l, vector<pair<ll,ll>> v){
double mn = 0;
for (ll i=0; i<n; i++){
ll x = v[i].first, y = v[i].second;
double d = dist(k, y);
if (d<=0) continue;
if (x-d<=mn) mn = max(mn, x+d);
}
return mn>=l;
}
void solve(){
ll n, len; cin >> n >> len;
map<ll, ll> ys;
for (ll i=0; i<n; i++){
ll x, y; cin >> x >> y;
if (ys.find(x) == ys.end()) ys[x] = abs(y);
else ys[x] = min(ys[x], abs(y));
}
vector<pair<ll, ll>> v;
for (auto el: ys){
v.push_back(make_pair(el.first, el.second));
}
sort(v.begin(), v.end());
n = size(v);
double l=0, r=1.5e9;
while (r-l>1e-4){
double mid = ((l+r)/2);
if (check(n, mid, len, v)) r=mid;
else l=mid;
}
cout << fixed << setprecision(4) << l;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
// your code goes here
// int t;
// cin >> t;
// while (t--)
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
860 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
5 ms |
908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
852 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
4 ms |
856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
860 KB |
Output is correct |
2 |
Correct |
3 ms |
860 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
1112 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
54 ms |
6916 KB |
Output is correct |
2 |
Correct |
42 ms |
5828 KB |
Output is correct |
3 |
Correct |
41 ms |
5628 KB |
Output is correct |
4 |
Correct |
49 ms |
7484 KB |
Output is correct |
5 |
Correct |
7 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
848 KB |
Output is correct |
2 |
Correct |
40 ms |
3720 KB |
Output is correct |
3 |
Correct |
50 ms |
6864 KB |
Output is correct |
4 |
Correct |
51 ms |
7880 KB |
Output is correct |
5 |
Correct |
81 ms |
8452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
67 ms |
8644 KB |
Output is correct |
2 |
Correct |
45 ms |
5576 KB |
Output is correct |
3 |
Correct |
44 ms |
7356 KB |
Output is correct |
4 |
Correct |
94 ms |
9784 KB |
Output is correct |
5 |
Correct |
33 ms |
2104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
4432 KB |
Output is correct |
2 |
Correct |
43 ms |
4452 KB |
Output is correct |
3 |
Correct |
34 ms |
2012 KB |
Output is correct |
4 |
Correct |
71 ms |
9932 KB |
Output is correct |
5 |
Correct |
69 ms |
8132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
9720 KB |
Output is correct |
2 |
Correct |
42 ms |
4552 KB |
Output is correct |
3 |
Correct |
31 ms |
2016 KB |
Output is correct |
4 |
Correct |
65 ms |
9924 KB |
Output is correct |
5 |
Correct |
84 ms |
8132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
47356 KB |
Output is correct |
2 |
Correct |
133 ms |
1364 KB |
Output is correct |
3 |
Correct |
177 ms |
1364 KB |
Output is correct |
4 |
Correct |
373 ms |
47380 KB |
Output is correct |
5 |
Correct |
317 ms |
31216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
138 ms |
1276 KB |
Output is correct |
2 |
Correct |
433 ms |
46956 KB |
Output is correct |
3 |
Correct |
204 ms |
9636 KB |
Output is correct |
4 |
Correct |
384 ms |
47316 KB |
Output is correct |
5 |
Correct |
378 ms |
43192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
393 ms |
58112 KB |
Output is correct |
2 |
Correct |
156 ms |
1016 KB |
Output is correct |
3 |
Correct |
153 ms |
1112 KB |
Output is correct |
4 |
Correct |
447 ms |
58220 KB |
Output is correct |
5 |
Correct |
325 ms |
29528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
158 ms |
992 KB |
Output is correct |
2 |
Correct |
485 ms |
57700 KB |
Output is correct |
3 |
Correct |
205 ms |
6716 KB |
Output is correct |
4 |
Correct |
482 ms |
58296 KB |
Output is correct |
5 |
Correct |
401 ms |
50616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
454 ms |
66788 KB |
Output is correct |
2 |
Correct |
173 ms |
852 KB |
Output is correct |
3 |
Correct |
170 ms |
824 KB |
Output is correct |
4 |
Correct |
532 ms |
66836 KB |
Output is correct |
5 |
Correct |
341 ms |
27080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
185 ms |
848 KB |
Output is correct |
2 |
Correct |
569 ms |
65972 KB |
Output is correct |
3 |
Correct |
274 ms |
12316 KB |
Output is correct |
4 |
Correct |
569 ms |
67584 KB |
Output is correct |
5 |
Correct |
480 ms |
58200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
543 ms |
76448 KB |
Output is correct |
2 |
Correct |
208 ms |
996 KB |
Output is correct |
3 |
Correct |
207 ms |
872 KB |
Output is correct |
4 |
Correct |
641 ms |
76768 KB |
Output is correct |
5 |
Correct |
516 ms |
47556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
205 ms |
828 KB |
Output is correct |
2 |
Correct |
683 ms |
74728 KB |
Output is correct |
3 |
Correct |
302 ms |
11972 KB |
Output is correct |
4 |
Correct |
611 ms |
75716 KB |
Output is correct |
5 |
Correct |
536 ms |
64728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
663 ms |
94548 KB |
Output is correct |
2 |
Correct |
246 ms |
888 KB |
Output is correct |
3 |
Correct |
225 ms |
880 KB |
Output is correct |
4 |
Correct |
785 ms |
94388 KB |
Output is correct |
5 |
Correct |
527 ms |
41912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
235 ms |
644 KB |
Output is correct |
2 |
Correct |
806 ms |
92588 KB |
Output is correct |
3 |
Correct |
387 ms |
15036 KB |
Output is correct |
4 |
Correct |
775 ms |
94236 KB |
Output is correct |
5 |
Correct |
690 ms |
80304 KB |
Output is correct |