Submission #715665

# Submission time Handle Problem Language Result Execution time Memory
715665 2023-03-27T12:59:09 Z MilosMilutinovic Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 8148 KB
#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, L;
    std::cin >> n >> L;

    std::vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i] >> y[i];
    }

    const double eps = 1E-4;

    std::function<bool(double)> check = [&](double r) {
        double f = 0;
        for (int i = 0; i < n; i++) {
            if (r * r >= (long double) y[i] * y[i]) {
                double p = std::sqrt(r * r - (long double) y[i] * y[i]);
                if (x[i] - p <= f) {
                    f = x[i] + p;
                }
            }
        }
        return f >= L;
    };

    double low = 0, high = 2E9, ans = -1;
    for (int i = 0; i < 200; i++) {
        double mid = (low + high) / 2;
        if (check(mid)) {
            ans = mid;
            high = mid;
        } else {
            low = mid;
        }
    }

    std::cout << std::fixed << std::setprecision(10) << ans << "\n";

    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:17:18: warning: unused variable 'eps' [-Wunused-variable]
   17 |     const double eps = 1E-4;
      |                  ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 6 ms 356 KB Output is correct
4 Incorrect 5 ms 360 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 87 ms 1000 KB Output is correct
2 Correct 95 ms 960 KB Output is correct
3 Correct 98 ms 980 KB Output is correct
4 Incorrect 54 ms 1108 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 102 ms 1108 KB Output is correct
2 Correct 98 ms 1108 KB Output is correct
3 Correct 107 ms 1108 KB Output is correct
4 Incorrect 50 ms 1108 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 102 ms 1108 KB Output is correct
2 Correct 105 ms 1108 KB Output is correct
3 Correct 108 ms 1112 KB Output is correct
4 Incorrect 64 ms 1108 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 493 ms 4228 KB Output is correct
2 Correct 543 ms 4236 KB Output is correct
3 Correct 559 ms 4228 KB Output is correct
4 Incorrect 260 ms 4228 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 510 ms 4236 KB Output is correct
2 Execution timed out 1078 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 596 ms 5004 KB Output is correct
2 Correct 656 ms 5008 KB Output is correct
3 Correct 601 ms 5008 KB Output is correct
4 Incorrect 319 ms 5012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 579 ms 5012 KB Output is correct
2 Execution timed out 1075 ms 4948 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 709 ms 5792 KB Output is correct
2 Correct 665 ms 5800 KB Output is correct
3 Correct 699 ms 5792 KB Output is correct
4 Incorrect 324 ms 5804 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 716 ms 5792 KB Output is correct
2 Execution timed out 1065 ms 5716 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 827 ms 6580 KB Output is correct
2 Correct 809 ms 6604 KB Output is correct
3 Correct 856 ms 6576 KB Output is correct
4 Incorrect 379 ms 6580 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 827 ms 6584 KB Output is correct
2 Execution timed out 1072 ms 6484 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 963 ms 8148 KB Output is correct
2 Correct 955 ms 8148 KB Output is correct
3 Execution timed out 1016 ms 8148 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -