Submission #1075314

# Submission time Handle Problem Language Result Execution time Memory
1075314 2024-08-26T02:13:15 Z vjudge1 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 40476 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 x1 = x[i] - d;
            x1 = min(x1, 1.0 * L);
            x1 = max(x1, 0.0);
            double x2 = x[i] + d;
            x2 = min(x2, 1.0 * L);
            x2 = max(x2, 0.0);
            if(x1 < x2) I.emplace_back(x1,x2);
        }
        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 < 200; i++) {
        double mid = lo + (hi - lo) / 2;
        if (p(mid)) hi = mid;
        else lo = mid;
    }
    cout << fixed << setprecision(8);
    cout << lo << '\n';

    return 0;
}
# 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 Incorrect 0 ms 380 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 700 KB Output is correct
2 Correct 25 ms 784 KB Output is correct
3 Correct 48 ms 748 KB Output is correct
4 Incorrect 5 ms 780 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 294 ms 4312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 4392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 719 ms 4648 KB Output is correct
2 Execution timed out 1022 ms 5760 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 884 ms 4920 KB Output is correct
2 Execution timed out 1024 ms 6308 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 295 ms 4828 KB Output is correct
2 Execution timed out 1097 ms 6312 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 20428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1024 ms 20464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 31008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 31024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 33340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 33416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 35704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 35708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 40404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 40476 KB Time limit exceeded
2 Halted 0 ms 0 KB -