# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1056868 | 2024-08-13T11:58:51 Z | TimAni | Mobile (BOI12_mobile) | C++17 | 1000 ms | 40768 KB |
// time-limit: 3000 #include <bits/stdc++.h> using namespace std; using ll = long long; const double eps = 1e-6; 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, double R) -> array<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}; } double D = R * R - A.y * A.y; // divided by 4 double x1 = A.x - sqrt(D); double x2 = A.x + sqrt(D); if(x2 < x1) swap(x1, x2); if(x1 < 0) x1 = 0; if(x2 > L) x2 = L; return {x1, x2}; }; auto good = [&](double R) { vector<array<double, 2>> segs; for(int i = 0; i < n; i++) { if(abs(p[i].y) > R) continue; else segs.push_back(intersection(p[i], R)); } sort(segs.begin(), segs.end()); double l = segs[0][0], r = segs[0][1]; int i = 0; while(i + 1 < segs.size() && segs[i + 1][0] <= r) { r = max(segs[i + 1][1], r); i++; } return r >= L && l <= 0; }; double l = 0, r = 4e9; while(r - l > eps) { double R = (r + l) / 2; if(good(R)) { r = R; } else { l = R; } } cout << fixed << setprecision(-log10(eps)) << r << endl; } int main() { cin.tie(0)->sync_with_stdio(0); double 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 | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 704 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 231 ms | 4316 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 283 ms | 4372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 256 ms | 4620 KB | Output is correct |
2 | Incorrect | 304 ms | 4464 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 281 ms | 4900 KB | Output is correct |
2 | Incorrect | 385 ms | 4888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 282 ms | 4908 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1010 ms | 20740 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1010 ms | 20484 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1093 ms | 31024 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1044 ms | 31088 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1048 ms | 35084 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1077 ms | 33576 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1061 ms | 37584 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1056 ms | 36056 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1082 ms | 40344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1020 ms | 40768 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |