Submission #1066366

# Submission time Handle Problem Language Result Execution time Memory
1066366 2024-08-19T19:18:54 Z JohnnyVenturas Mobile (BOI12_mobile) C++17
12 / 100
533 ms 8044 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 << fixed << setprecision(4) << first_true(0, l, [&](double r) {
        double low = l, high = 0;

        for (int i = 0; i < n; ++i) {
            double left = receivers[i].x -
                           sqrt(r * r - receivers[i].y * receivers[i].y);
            double right =  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 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 448 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 452 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 2652 KB Output is correct
2 Incorrect 37 ms 2652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 2652 KB Output is correct
2 Correct 38 ms 2652 KB Output is correct
3 Incorrect 52 ms 2652 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2648 KB Output is correct
2 Incorrect 40 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 2652 KB Output is correct
2 Incorrect 47 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 2640 KB Output is correct
2 Incorrect 48 ms 2648 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 187 ms 4688 KB Output is correct
2 Incorrect 259 ms 4688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 271 ms 4632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 221 ms 6740 KB Output is correct
2 Incorrect 359 ms 6744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 325 ms 6736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 299 ms 6736 KB Output is correct
2 Incorrect 354 ms 6740 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 378 ms 6740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 368 ms 6736 KB Output is correct
2 Incorrect 412 ms 6752 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 452 ms 6740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 412 ms 8044 KB Output is correct
2 Incorrect 506 ms 8016 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 533 ms 8036 KB Output isn't correct
2 Halted 0 ms 0 KB -