# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464126 | 2021-08-12T12:17:49 Z | dqk | Mobile (BOI12_mobile) | C++17 | 232 ms | 2364 KB |
#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; for (int i = 0; i < n; ++i) { int x, y; std::cin >> x >> y; y = abs(y); if (i == 0) p.push_back({x, y}); else { if (x == p[p.size() - 1][0]) p[p.size() - 1][1] = std::min(p[p.size() - 1][1], y); } } n = (int) p.size(); double d1 = sqrt(p[0][0] * p[0][0] + p[0][1] * p[0][1]); double d2 = sqrt((p[0][0] - L) * (p[0][0] - L) + p[0][1] * p[0][1]); double lo = 0, hi = std::max(d1, d2); while(hi - lo > 1e-4) { double mi = (lo + hi) / 2; std::vector<std::vector<double>> u; for (int i = 0; i < n; ++i) { double h = 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.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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 1104 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 1056 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1832 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1836 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 2284 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 2336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 104 ms | 2364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 143 ms | 2336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 122 ms | 2248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 164 ms | 2316 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 137 ms | 2340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 187 ms | 2232 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 169 ms | 2332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 232 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |