Submission #1075324

# Submission time Handle Problem Language Result Execution time Memory
1075324 2024-08-26T02:27:00 Z vjudge1 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 53464 KB
#include <bits/stdc++.h>
using namespace std;

#define dbg(x) cerr << #x << " = " << x << endl
#define raya cerr << string(20, '=') << endl
#define pv(x) cerr << #x << "[] : "; for (auto e:x) cerr << e << " "; cerr << endl

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define eb emplace_back
#define ff first
#define ss second

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(nullptr);
    int n,L;
    cin >> n >> L;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];

    auto p = [&](double R) -> bool {
        vector<pair<double,double>> I;
        for (int i = 0; i < n; i++) {
            if (abs(y[i]) > R) continue;
            double d = sqrt(R * R - 1ll * y[i] * y[i]);
            double xL = x[i] - d;
            double xR = x[i] + d;
            if (xR < 0) continue;
            else if (xL < 0) xL = 0;
            else {
                if (xL <= L) {
                    if (xR > L) xR = L;
                }
                else {
                    continue;
                }
            }
            I.emplace_back(xL, xR);
        }
        sort(all(I));
        if (I.empty()) return 0;
        if (I.front().ff > 0 or I.back().ss < L) return 0;
        for (int i = 0; i < sz(I) - 1; i++) {
            if (I[i].ss < I[i + 1].ff) return 0;
        }
        return 1;
    };
    double lo = 0, hi = 3e9;
    for (int i = 0; i < 300; i++) {
        double mid = (lo + hi) / 2;
        if (p(mid)) hi = mid;
        else lo = mid;
    }
    cout << fixed << setprecision(10);
    cout << lo << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 452 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 760 KB Output is correct
2 Correct 35 ms 780 KB Output is correct
3 Correct 72 ms 748 KB Output is correct
4 Incorrect 7 ms 792 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 411 ms 5092 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 148 ms 5108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 972 ms 5332 KB Output is correct
2 Execution timed out 1059 ms 5660 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 6456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 319 ms 6320 KB Output is correct
2 Execution timed out 1084 ms 6296 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1028 ms 24196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 27088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 35360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 38652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 38224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 42276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 41348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 45940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 47324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 53464 KB Time limit exceeded
2 Halted 0 ms 0 KB -