이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN = 1000000;
int n, l, x[mxN], y[mxN];
bool ok(double d) {
// vector<pair<double, double>> d;
vector<pair<double, int>> e;
for (int i = 0; i < n; ++i) {
if (abs(y[i]) < d) {
double r = sqrt(d * d - (ll)y[i] * y[i]);
double ls = x[i] - r;
double rs = x[i] + r;
if (rs > 0 && ls < l) {
ls = max(ls, 0.0);
rs = min(rs, l + 1e-9);
// d.emplace_back(ls, rs);
e.emplace_back(ls, -1);
e.emplace_back(rs, 1);
}
}
}
// for (auto& x : e) cout << x.first << " " << x.second << "\n";
sort(e.begin(), e.end());
if (e[0].first != 0 || e.back().first < l) return 0;
int cur = 0;
for (int i = 0; i < (int)e.size(); ++i) {
cur -= e[i].second;
if (i != (int)e.size() - 1 && cur <= 0) return 0;
}
return 1;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(6);
cin >> n >> l;
for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
double lb = 0, rb = 2e9;
while(lb + (1e-7) < rb) {
double mid = (lb + rb) / 2;
if (ok(mid)) rb = mid;
else lb = mid;
}
cout << lb;
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... |