Submission #1066359

# Submission time Handle Problem Language Result Execution time Memory
1066359 2024-08-19T19:10:47 Z JohnnyVenturas Mobile (BOI12_mobile) C++17
0 / 100
542 ms 24656 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e6;

struct point {
    int x, y;
};

point receivers[MAXN];

double first_true(double low, double high, function<bool(double)> f) {
    --low, ++high;
    double mid;
    while (high - low > 1e-3) {
        mid = low + (high - low) /2;
        if (f(mid)) {
            high = mid;
        } else {
            low = mid;
        }
    }

    return high;
}

int main() {
    int n, l;
    cin >> n >> l;

    for (int i = 0; i < n; ++i) {
        cin >> receivers[i].x >> receivers[i].y;
    }

    cout << first_true(0, l, [&](double r) {
        double low = 0, high = 0;

        for (int i = 0; i < n; ++i) {
            double left =
                max(0., receivers[i].x -
                           sqrt(r * r - receivers[i].y * receivers[i].y));
            double right =
                min((double)l, receivers[i].x +
                           sqrt(r * r - receivers[i].y * receivers[i].y));

            if (left <= high) {
                low = min(low, left);
                high = max(high, right);
            }
        }

        return low == 0 && high == l;
    });
}
# 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 1 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 496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 600 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 35 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3136 KB Output is correct
2 Incorrect 44 ms 3688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 4176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 4052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 203 ms 8936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 12884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 271 ms 11848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 333 ms 16584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 290 ms 12760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 396 ms 18256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 302 ms 13652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 493 ms 19928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 365 ms 16848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 542 ms 24656 KB Output isn't correct
2 Halted 0 ms 0 KB -