Submission #1066372

# Submission time Handle Problem Language Result Execution time Memory
1066372 2024-08-19T19:23:51 Z JohnnyVenturas Mobile (BOI12_mobile) C++17
12 / 100
623 ms 8240 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 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) {
                high = max(high, right);
            }
        }

        return high >= l;
    });
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 600 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 0 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 3 ms 348 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 3 ms 348 KB Output is correct
4 Incorrect 4 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 476 KB Output is correct
3 Correct 3 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 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 41 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 40 ms 2648 KB Output is correct
2 Correct 38 ms 2652 KB Output is correct
3 Incorrect 56 ms 2660 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 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 56 ms 2652 KB Output is correct
2 Incorrect 48 ms 1196 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1104 KB Output is correct
2 Incorrect 54 ms 1136 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 183 ms 4288 KB Output is correct
2 Incorrect 311 ms 4176 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 279 ms 4692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 241 ms 6748 KB Output is correct
2 Incorrect 329 ms 6736 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 341 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 310 ms 6736 KB Output is correct
2 Incorrect 376 ms 6740 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 6740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 382 ms 6740 KB Output is correct
2 Incorrect 474 ms 6756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 448 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 382 ms 8240 KB Output is correct
2 Incorrect 568 ms 8020 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 623 ms 8028 KB Output isn't correct
2 Halted 0 ms 0 KB -