Submission #551246

# Submission time Handle Problem Language Result Execution time Memory
551246 2022-04-20T06:42:30 Z narcissus Mobile (BOI12_mobile) C++17
0 / 100
782 ms 9332 KB
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;
    pair<int, int> coords[n];
    for (int i = 0; i < n; i++) {
        cin >> coords[i].first >> coords[i].second;
    }

    double low = 1, high = 2e9;
    while (high - low > 1e-3) {
        double mid = low + (high - low) / 2;
        // cout << mid << ":" << endl;
        double minv = l, maxv = 0;
        for (int i = 0; i < n; i++) {
            int x = coords[i].first;
            int y = coords[i].second;
            double xdist = sqrt(abs(pow(mid, 2) - pow(y, 2)));
            double a1 = max((double)0, x - xdist);
            double a2 = min((double)l, x + xdist);
            minv = min(minv, a1);
            // cout << "a " << a1 << ' ' << a2 << endl;
            if (i) {
                if (a1 <= maxv)
                    maxv = max(maxv, a2);
            } else {
                maxv = a2;
            }
        }
        if (minv <= 0 && maxv >= l) {
            high = mid;
        } else {
            low = mid;
        }
    }
    cout << high << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1596 KB Output is correct
2 Incorrect 66 ms 1844 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 2084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 2016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 284 ms 5316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 388 ms 5192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 337 ms 5988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 470 ms 6200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 390 ms 6876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 538 ms 6816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 452 ms 7560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 7556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 553 ms 9332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 782 ms 8124 KB Output isn't correct
2 Halted 0 ms 0 KB -