이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* AUTHOR: __SIGSEGV__
* CREATED: 30.08.2020 02:54:38
**/
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double inf = 1e18;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
double l;
cin >> n >> l;
vector<pair<int, int>> points(n);
for (int i = 0; i < n; i++) {
cin >> points[i].first >> points[i].second;
points[i].second = abs(points[i].second);
}
sort(points.begin(), points.end());
vector<pair<double, double>> poi;
int last;
for (int i = 0; i < n; i++) {
poi.emplace_back((double) points[i].first, (double) points[i].second);
last = points[i].first;
i++;
while (i < n && points[i].first == last) ++i;
--i;
}
auto f = [&](double x) {
double ret = inf;
for (int i = 0; i < n; i++) {
double d = sqrt(poi[i].second * poi[i].second + abs(x - poi[i].first) * abs(x - poi[i].first));
ret = min(ret, d);
}
return ret;
};
double left = 0, right = l;
while (abs(right - left) > eps) {
double x1 = left + (right - left) / 3.0;
double x2 = right - (right - left) / 3.0;
double f1 = f(x1), f2 = f(x2);
cerr << x1 << " " << x2 << '\n';
if (f1 < f2) left = x1;
else right = x2;
}
double ans = f(left);
cout.precision(6);
cout << fixed;
cout << ans << '\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... |