# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464003 | dqk | Mobile (BOI12_mobile) | C++17 | 1092 ms | 111736 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>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
double L;
std::cin >> n >> L;
std::vector<std::vector<int>> p(n, std::vector<int>(2, 0));
for (int i = 0; i < n; ++i) {
std::cin >> p[i][0] >> p[i][1];
}
double lo = 0, hi = 1e10;
while(hi - lo > 1e-6) {
double mi = (lo + hi) / 2;
std::vector<std::vector<double>> u;
for (int i = 0; i < n; ++i) {
double h = abs(p[i][1]);
if (h > mi)
continue;
double lf = p[i][0] - sqrt(mi * mi - h * h);
double rt = p[i][0] + sqrt(mi * mi - h * h);
if (rt < 0 || lf > L)
continue;
lf = std::max(lf, 0.0);
rt = std::min(rt, L);
u.push_back({lf, rt});
}
sort(u.begin(), u.end());
double lf, rt;
lf = rt = -1;
bool ok = true;
for (int i = 0; i < u.size() && ok; ++i) {
if (i == 0) {
lf = u[i][0];
rt = u[i][1];
}
else {
if (u[i][0] > rt)
ok = false;
rt = std::max(rt, u[i][1]);
}
}
if (lf != 0 && rt != L)
ok = false;
if (ok) {
hi = mi;
}
else {
lo = mi;
}
}
std::cout << lo << "\n";
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... |