Submission #1066369

# Submission time Handle Problem Language Result Execution time Memory
1066369 2024-08-19T19:20:46 Z JohnnyVenturas Mobile (BOI12_mobile) C++17
12 / 100
600 ms 8152 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, 2e9, [&](double r) {
        double low = 2e9, 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 1 ms 348 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 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 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 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Incorrect 3 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Incorrect 3 ms 412 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 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 45 ms 2652 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 43 ms 2652 KB Output is correct
2 Correct 49 ms 2648 KB Output is correct
3 Incorrect 54 ms 2652 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2648 KB Output is correct
2 Incorrect 42 ms 2652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2652 KB Output is correct
2 Incorrect 52 ms 2652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2648 KB Output is correct
2 Incorrect 50 ms 2652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 194 ms 4692 KB Output is correct
2 Incorrect 286 ms 4692 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 270 ms 4692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 245 ms 6740 KB Output is correct
2 Incorrect 317 ms 6760 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 337 ms 6736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 264 ms 6740 KB Output is correct
2 Incorrect 401 ms 6700 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 432 ms 6736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 316 ms 6736 KB Output is correct
2 Incorrect 432 ms 6992 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 517 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 393 ms 8152 KB Output is correct
2 Incorrect 550 ms 8020 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 600 ms 8024 KB Output isn't correct
2 Halted 0 ms 0 KB -