# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
356766 | penguinhacker | Mobile (BOI12_mobile) | C++14 | 1101 ms | 74052 KiB |
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;
#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 < e.size(); ++i) {
cur += e[i].second;
assert(cur >= 0);
if (i != 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;
}
Compilation message (stderr)
# | 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... |