This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int main() {
ios::sync_with_stdio(0);
cin.tie(nullptr);
int n; cin >> n;
ld ll; cin >> ll;
ld lo = 0, hi = 1e12;
vector<pair<ld, ld>> poi(n);
for (int i = 0; i < n; ++i) cin >> poi[i].first >> poi[i].second;
while (hi - lo > 1e-4) {
ld mi = (lo + hi) / 2;
ld till = 0;
for (int i = 0; i < n; ++i) {
if (mi * mi - poi[i].second * poi[i].second < 0) continue;
ld sq = sqrt(mi * mi - poi[i].second * poi[i].second);
ld h = sq + poi[i].first;
ld l = - sq + poi[i].first;
if (l <= till) {
till = max(till, h);
}
}
if (till >= ll) {
hi = mi;
} else {
lo = mi;
}
}
cout << fixed << setprecision(3) << lo << '\n';
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... |