# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464136 | 2021-08-12T12:42:49 Z | dqk | Mobile (BOI12_mobile) | C++17 | 1000 ms | 78348 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(n, std::vector<int>(2, 0)); for (int i = 0; i < n; ++i) { std::cin >> p[i][0] >> p[i][1]; p[i][1] = abs(p[i][1]); } sort(p.begin(), p.end(), [] (auto a, auto b) { if (a[1] == b[1]) return a[0] < b[0]; return a[1] < b[1]; }); 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-3) { double mi = (lo + hi) / 2; std::vector<std::vector<double>> u; bool ltok = false; bool rtok = false; for (int i = 0; i < n && p[i][1] <= mi; ++i) { double h = p[i][1]; 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}); if (rt == L) rtok = true; if (lf == 0.0) ltok = true; } sort(u.begin(), u.end()); bool ok = rtok & ltok; for (int i = 0; i < u.size() - 1 && ok; ++i) { if (u[i + 1][0] > u[i][1]) ok = false; } if (ok) { hi = mi; } else { lo = mi; } } std::cout << lo << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | 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 | 13 ms | 664 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 712 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 852 KB | Output is correct |
2 | Incorrect | 17 ms | 804 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 4300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 574 ms | 10608 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 534 ms | 11420 KB | Output is correct |
2 | Incorrect | 226 ms | 5580 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 415 ms | 9136 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 153 ms | 5708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1088 ms | 55112 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 903 ms | 27596 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 78348 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1057 ms | 33132 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 38636 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1077 ms | 38604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 44044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 44084 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 54984 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1103 ms | 55096 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |