#include "bits/stdc++.h"
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const char nl = '\n';
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int EPS = 1e-3;
struct point {
double x, y;
bool operator<(const point &o) { return x < o.x; }
};
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n; double k; cin >> n >> k;
vector<point> v(n); for (auto &[a, b] : v) cin >> a >> b;
auto check = [&](double d) -> bool {
vector<point> aux;
for (int i = 0; i < n; i++) {
double dd = sqrt(d * d - v[i].y * v[i].y);
aux.push_back({v[i].x - dd, v[i].x + dd});
}
sort(all(aux));
double p = 0;
for (int i = 0; i < n; i++) {
if (p < aux[i].x) return false;
p = max(p, aux[i].y);
if (p > k) return true;
}
return p > k;
};
double l = 0; // l is bad
double r = 1e18; // r is good
for (int i = 0; i < 200; i++) {
double m = (l + r) / 2;
check(m) ? r = m : l = m;
}
cout << fixed << setprecision(6) << r << nl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |