Submission #715666

# Submission time Handle Problem Language Result Execution time Memory
715666 2023-03-27T12:59:58 Z MilosMilutinovic Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 17724 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 = std::max(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 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 6 ms 328 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 6 ms 332 KB Output is correct
3 Correct 5 ms 396 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 8 ms 364 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 130 ms 904 KB Output is correct
2 Correct 77 ms 2000 KB Output is correct
3 Correct 50 ms 1360 KB Output is correct
4 Correct 40 ms 2184 KB Output is correct
5 Correct 22 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 852 KB Output is correct
2 Correct 34 ms 1620 KB Output is correct
3 Correct 43 ms 1992 KB Output is correct
4 Correct 51 ms 2096 KB Output is correct
5 Correct 47 ms 2404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 1008 KB Output is correct
2 Correct 85 ms 960 KB Output is correct
3 Correct 76 ms 980 KB Output is correct
4 Correct 45 ms 1108 KB Output is correct
5 Correct 42 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 1108 KB Output is correct
2 Correct 117 ms 1108 KB Output is correct
3 Correct 81 ms 1108 KB Output is correct
4 Correct 48 ms 1108 KB Output is correct
5 Correct 48 ms 2240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 1108 KB Output is correct
2 Correct 101 ms 1108 KB Output is correct
3 Correct 82 ms 1108 KB Output is correct
4 Correct 52 ms 1108 KB Output is correct
5 Correct 52 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 547 ms 4228 KB Output is correct
2 Correct 547 ms 4180 KB Output is correct
3 Correct 527 ms 4228 KB Output is correct
4 Correct 222 ms 4228 KB Output is correct
5 Correct 230 ms 11068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 530 ms 4236 KB Output is correct
2 Execution timed out 1082 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 632 ms 5012 KB Output is correct
3 Correct 611 ms 5004 KB Output is correct
4 Correct 266 ms 4948 KB Output is correct
5 Correct 276 ms 12936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 576 ms 5012 KB Output is correct
2 Execution timed out 1078 ms 4948 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 742 ms 5796 KB Output is correct
2 Correct 658 ms 5792 KB Output is correct
3 Correct 782 ms 5800 KB Output is correct
4 Correct 318 ms 5716 KB Output is correct
5 Correct 353 ms 14880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 699 ms 5800 KB Output is correct
2 Execution timed out 1079 ms 5716 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 799 ms 6484 KB Output is correct
2 Correct 768 ms 6576 KB Output is correct
3 Correct 856 ms 6584 KB Output is correct
4 Correct 448 ms 6580 KB Output is correct
5 Correct 550 ms 17724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 908 ms 6576 KB Output is correct
2 Execution timed out 1082 ms 6484 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -