# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464129 | 2021-08-12T12:25:06 Z | dqk | Mobile (BOI12_mobile) | C++17 | 1000 ms | 109916 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]); } 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; 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 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 0 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 588 KB | Output is correct |
2 | Incorrect | 8 ms | 648 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 844 KB | Output is correct |
2 | Incorrect | 2 ms | 560 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 844 KB | Output is correct |
2 | Incorrect | 2 ms | 560 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 844 KB | Output is correct |
2 | Incorrect | 3 ms | 460 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 4412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 9648 KB | Output is correct |
2 | Correct | 52 ms | 9228 KB | Output is correct |
3 | Incorrect | 66 ms | 9820 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 361 ms | 11368 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 5708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 279 ms | 12392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1087 ms | 55132 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 192 ms | 28340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 78412 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 193 ms | 33152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 89344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 38624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1101 ms | 100288 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 230 ms | 44080 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1100 ms | 109916 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 373 ms | 55436 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |