# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1056808 | 2024-08-13T11:26:32 Z | TimAni | Mobile (BOI12_mobile) | C++17 | 1000 ms | 39520 KB |
// time-limit: 3000 #include <bits/stdc++.h> using namespace std; using ll = long long; struct point { int x{}, y{}; }; void solve() { int n, L; cin >> n >> L; vector<point> p(n); for(int i = 0; i < n; i++) { cin >> p[i].x >> p[i].y; } auto intersection = [&](const point& A, long double R) -> array<long double, 2> { // y^2 = 0, // y^2 = R^2 - (x - A.x)^2 + 2yA.y - A.y ^ 2; // R^2 - (x - A.x) ^ 2 - A.y^2 = 0 // R^2 - x^2 + 2xA.x - A.x^2 - A.y^2 = 0 // x^2 - 2xA.x + A.x^2 + A.y^2 - R^2 = 0 // D = -4A.y^2 + 4R^2 if(abs(A.y) > R) { return {L + 1, -1}; } long double D = 4 * (R * R - A.y * A.y); long double x1 = (2 * A.x - sqrt(D)) / 2; long double x2 = (2 * A.x + sqrt(D)) / 2; if(x1 < 0) x1 = 0; if(x2 > L) x2 = L; return {x1, x2}; }; auto good = [&](long double R) { vector<array<long double, 2>> segs(n); for(int i = 0; i < n; i++) { segs[i] = intersection(p[i], R); } sort(segs.begin(), segs.end()); long double l = segs[0][0], r = segs[0][1]; int i = 0; while(i + 1 < n && segs[i + 1][0] <= r) { r = max(segs[i + 1][1], r); i++; } if(r != L || l != 0) return 0; return 1; }; long double l = 0, r = hypot(2e9, 1e9); for(int i = 0; i < 50; i++) { long double R = (r + l) / 2; if(good(R)) { r = R; } else { l = R; } } cout << fixed << setprecision(6) << r << endl; } int main() { cin.tie(0)->sync_with_stdio(0); int T = 1; //cin >> T; while(T--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 514 ms | 3384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 665 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 581 ms | 3908 KB | Output is correct |
2 | Incorrect | 521 ms | 4700 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 645 ms | 4360 KB | Output is correct |
2 | Incorrect | 754 ms | 5772 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 736 ms | 4320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1065 ms | 20016 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1014 ms | 19792 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 23892 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1084 ms | 23892 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1041 ms | 27828 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1014 ms | 27848 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1102 ms | 31620 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 31636 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 39508 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1012 ms | 39520 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |