Submission #1066375

# Submission time Handle Problem Language Result Execution time Memory
1066375 2024-08-19T19:25:49 Z JohnnyVenturas Mobile (BOI12_mobile) C++17
100 / 100
839 ms 15976 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e6;

struct point {
    long long 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 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 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 348 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 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 4 ms 516 KB Output is correct
# 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 Correct 4 ms 348 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2652 KB Output is correct
2 Correct 39 ms 2652 KB Output is correct
3 Correct 24 ms 2652 KB Output is correct
4 Correct 50 ms 2648 KB Output is correct
5 Correct 22 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 2648 KB Output is correct
2 Correct 40 ms 2652 KB Output is correct
3 Correct 48 ms 2652 KB Output is correct
4 Correct 69 ms 2648 KB Output is correct
5 Correct 62 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2652 KB Output is correct
2 Correct 40 ms 2652 KB Output is correct
3 Correct 41 ms 2648 KB Output is correct
4 Correct 88 ms 2652 KB Output is correct
5 Correct 45 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 2652 KB Output is correct
2 Correct 49 ms 2652 KB Output is correct
3 Correct 51 ms 2652 KB Output is correct
4 Correct 76 ms 2648 KB Output is correct
5 Correct 57 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2652 KB Output is correct
2 Correct 48 ms 2648 KB Output is correct
3 Correct 45 ms 2652 KB Output is correct
4 Correct 80 ms 2660 KB Output is correct
5 Correct 58 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 187 ms 8036 KB Output is correct
2 Correct 268 ms 8784 KB Output is correct
3 Correct 237 ms 9044 KB Output is correct
4 Correct 386 ms 8016 KB Output is correct
5 Correct 301 ms 8016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 271 ms 8784 KB Output is correct
2 Correct 320 ms 8244 KB Output is correct
3 Correct 225 ms 8800 KB Output is correct
4 Correct 381 ms 8028 KB Output is correct
5 Correct 331 ms 8796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 261 ms 10836 KB Output is correct
2 Correct 300 ms 10064 KB Output is correct
3 Correct 285 ms 9808 KB Output is correct
4 Correct 450 ms 10836 KB Output is correct
5 Correct 351 ms 10848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 335 ms 11096 KB Output is correct
2 Correct 380 ms 10848 KB Output is correct
3 Correct 288 ms 11092 KB Output is correct
4 Correct 448 ms 10852 KB Output is correct
5 Correct 371 ms 10852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 254 ms 11360 KB Output is correct
2 Correct 348 ms 11344 KB Output is correct
3 Correct 330 ms 11344 KB Output is correct
4 Correct 525 ms 11360 KB Output is correct
5 Correct 398 ms 11348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 383 ms 11344 KB Output is correct
2 Correct 433 ms 11360 KB Output is correct
3 Correct 316 ms 12884 KB Output is correct
4 Correct 518 ms 12904 KB Output is correct
5 Correct 436 ms 12892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 291 ms 14932 KB Output is correct
2 Correct 398 ms 14952 KB Output is correct
3 Correct 385 ms 15188 KB Output is correct
4 Correct 604 ms 14956 KB Output is correct
5 Correct 477 ms 14944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 443 ms 14932 KB Output is correct
2 Correct 485 ms 14928 KB Output is correct
3 Correct 366 ms 14956 KB Output is correct
4 Correct 619 ms 14928 KB Output is correct
5 Correct 499 ms 14944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 365 ms 15956 KB Output is correct
2 Correct 500 ms 15956 KB Output is correct
3 Correct 495 ms 15964 KB Output is correct
4 Correct 745 ms 15976 KB Output is correct
5 Correct 590 ms 15968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 574 ms 15972 KB Output is correct
2 Correct 632 ms 15956 KB Output is correct
3 Correct 514 ms 15852 KB Output is correct
4 Correct 839 ms 15968 KB Output is correct
5 Correct 655 ms 15972 KB Output is correct