# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464133 | 2021-08-12T12:32:59 Z | dqk | Mobile (BOI12_mobile) | C++17 | 1000 ms | 126340 KB |
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n; long 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]); } long double d1 = sqrt(p[0][0] * p[0][0] + p[0][1] * p[0][1]); long double d2 = sqrt((p[0][0] - L) * (p[0][0] - L) + p[0][1] * p[0][1]); long double lo = 0, hi = std::max(d1, d2); while(hi - lo > 1e-4) { long double mi = (lo + hi) / 2; std::vector<std::vector<long double>> u; bool ltok = false; bool rtok = false; for (int i = 0; i < n; ++i) { long double h = p[i][1]; if (h > mi) continue; long double lf = p[i][0] - sqrt(mi * mi - h * h); long double rt = p[i][0] + sqrt(mi * mi - h * h); if (rt < 0.0 || lf > L) continue; lf = (lf > 0.0 ? 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 | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 204 KB | Output isn't correct |
# | 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 | 5 ms | 676 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 1044 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 972 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 972 KB | Output is correct |
2 | Incorrect | 2 ms | 588 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 4812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 85 ms | 11136 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 818 ms | 12208 KB | Output is correct |
2 | Incorrect | 25 ms | 5212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 6172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 479 ms | 13228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1085 ms | 63716 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 434 ms | 30380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 88568 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 198 ms | 33856 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 92828 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 226 ms | 39364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1088 ms | 101292 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 247 ms | 44868 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1099 ms | 126340 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 496 ms | 56084 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |