Submission #570582

# Submission time Handle Problem Language Result Execution time Memory
570582 2022-05-30T14:21:54 Z TheEccentricDuck Mobile (BOI12_mobile) C++17
100 / 100
867 ms 17032 KB
//======================================================================================================================
// Name        : BOI12_MOBILE.cpp
// Author      : Jinchen Li
// Date Created: 5/30/2022
// Description : oj.uz, Mobile in C++, Ansi-style
//======================================================================================================================

// Directives
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")

// Main
int main() {
    // Initialisation
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    // Accepting Inputs
    int N;
    int L;
    std::cin >> N >> L;
    std::vector<double> x(N);
    std::vector<double> y(N);
    for (int i = 0; i < N; i++) {
        std::cin >> x[i] >> y[i];
    }

    // Processing Inputs
    double low = 1;
    double high = 1.5e9;
    while (high - low > 1e-3) {
        double mid = (low + high) / 2;
        double cur = 0;
        for (int i = 0; i < N; i++) {
            double delta = std::sqrt(mid * mid - y[i] * y[i]);
            double a = x[i] - delta;
            double b = x[i] + delta;
            if (a <= cur) {
                cur = std::max(cur, b);
            }
        }

        if (cur >= L) {
            high = mid;
        }
        else {
            low = mid;
        }
    }

    // Printing Outputs
    std::cout << std::fixed << std::setprecision(4) << low;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 328 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 4 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 6 ms 460 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 5 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 5 ms 468 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 6 ms 488 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 1492 KB Output is correct
2 Correct 56 ms 1748 KB Output is correct
3 Correct 35 ms 1364 KB Output is correct
4 Correct 60 ms 1748 KB Output is correct
5 Correct 33 ms 1352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 1492 KB Output is correct
2 Correct 59 ms 1576 KB Output is correct
3 Correct 64 ms 1844 KB Output is correct
4 Correct 66 ms 2020 KB Output is correct
5 Correct 79 ms 2148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 1620 KB Output is correct
2 Correct 61 ms 1860 KB Output is correct
3 Correct 63 ms 1904 KB Output is correct
4 Correct 91 ms 2388 KB Output is correct
5 Correct 67 ms 1964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 1876 KB Output is correct
2 Correct 73 ms 2328 KB Output is correct
3 Correct 71 ms 2124 KB Output is correct
4 Correct 100 ms 2396 KB Output is correct
5 Correct 80 ms 2268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 1876 KB Output is correct
2 Correct 75 ms 2464 KB Output is correct
3 Correct 72 ms 2124 KB Output is correct
4 Correct 92 ms 2388 KB Output is correct
5 Correct 96 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 8148 KB Output is correct
2 Correct 359 ms 8844 KB Output is correct
3 Correct 373 ms 8792 KB Output is correct
4 Correct 429 ms 8784 KB Output is correct
5 Correct 382 ms 8796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 362 ms 8148 KB Output is correct
2 Correct 427 ms 9172 KB Output is correct
3 Correct 337 ms 8908 KB Output is correct
4 Correct 411 ms 8784 KB Output is correct
5 Correct 389 ms 8976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 443 ms 9704 KB Output is correct
2 Correct 456 ms 13836 KB Output is correct
3 Correct 441 ms 13724 KB Output is correct
4 Correct 554 ms 13808 KB Output is correct
5 Correct 472 ms 13828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 449 ms 9720 KB Output is correct
2 Correct 552 ms 10476 KB Output is correct
3 Correct 404 ms 10480 KB Output is correct
4 Correct 529 ms 10468 KB Output is correct
5 Correct 453 ms 10476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 505 ms 11276 KB Output is correct
2 Correct 506 ms 15020 KB Output is correct
3 Correct 534 ms 14984 KB Output is correct
4 Correct 602 ms 15148 KB Output is correct
5 Correct 552 ms 14964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 552 ms 11272 KB Output is correct
2 Correct 600 ms 11792 KB Output is correct
3 Correct 476 ms 11800 KB Output is correct
4 Correct 583 ms 11920 KB Output is correct
5 Correct 540 ms 11944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 540 ms 12836 KB Output is correct
2 Correct 609 ms 13480 KB Output is correct
3 Correct 564 ms 13544 KB Output is correct
4 Correct 722 ms 13368 KB Output is correct
5 Correct 599 ms 13360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 601 ms 12840 KB Output is correct
2 Correct 674 ms 13512 KB Output is correct
3 Correct 528 ms 13500 KB Output is correct
4 Correct 674 ms 13480 KB Output is correct
5 Correct 639 ms 13348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 675 ms 15988 KB Output is correct
2 Correct 741 ms 16508 KB Output is correct
3 Correct 712 ms 16716 KB Output is correct
4 Correct 863 ms 16084 KB Output is correct
5 Correct 768 ms 16780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 757 ms 15972 KB Output is correct
2 Correct 842 ms 17032 KB Output is correct
3 Correct 684 ms 16808 KB Output is correct
4 Correct 867 ms 16084 KB Output is correct
5 Correct 754 ms 16772 KB Output is correct