# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083685 | 2024-09-03T20:21:51 Z | vjudge1 | Mobile (BOI12_mobile) | C++17 | 590 ms | 32404 KB |
#include <iostream> #include <vector> #include <cmath> #include <iomanip> using namespace std; // Function to check if a given radius R can cover the entire highway bool canCoverAllPoints(const vector<pair<double, double>>& stations, double R, double L) { double coveredUntil = 0.0; for (const auto& station : stations) { double xi = station.first; double yi = station.second; if (yi > R) continue; // This base station is too far away to help // Calculate the maximum x-range this station can cover double d = sqrt(R * R - yi * yi); double coverageStart = max(0.0, xi - d); double coverageEnd = xi + d; // Extend the coverage coveredUntil = max(coveredUntil, coverageEnd); if (coveredUntil >= L) return true; // Covered the entire highway } return coveredUntil >= L; } int main() { int N; double L; cin >> N >> L; vector<pair<double, double>> stations(N); for (int i = 0; i < N; ++i) { double xi, yi; cin >> xi >> yi; stations[i] = {xi, yi}; } // Binary search for the smallest possible R double low = 0.0; double high = 1e9; double epsilon = 1e-4; // Precision to ensure accuracy within 1e-3 while (high - low > epsilon) { double mid = (low + high) / 2.0; if (canCoverAllPoints(stations, mid, L)) { high = mid; // Try smaller radius } else { low = mid; // Increase radius } } cout << fixed << setprecision(6) << high << endl; return 0; }
Compilation message
# | 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 | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 37 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 41 ms | 2160 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 2388 KB | Output is correct |
2 | Incorrect | 43 ms | 2648 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 3380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 60 ms | 3408 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 12368 KB | Output is correct |
2 | Incorrect | 300 ms | 15908 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 300 ms | 16208 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 311 ms | 14928 KB | Output is correct |
2 | Incorrect | 341 ms | 19028 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 370 ms | 19524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 358 ms | 17256 KB | Output is correct |
2 | Incorrect | 396 ms | 22100 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 416 ms | 22884 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 414 ms | 19792 KB | Output is correct |
2 | Incorrect | 466 ms | 25168 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 469 ms | 25940 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 522 ms | 24660 KB | Output is correct |
2 | Incorrect | 586 ms | 31548 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 590 ms | 32404 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |