Submission #1056931

# Submission time Handle Problem Language Result Execution time Memory
1056931 2024-08-13T12:32:40 Z TimAni Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 24160 KB
// time-limit: 3000
 
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
const double eps = 1E-4;
 
struct point {
    int x{}, y{};
};
 
void solve() {
    int n, L;
    cin >> n >> L;
    vector<point> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
    }
    auto intersection = [&](const point& A, double R) -> array<double, 2> {
        if(abs(A.y) > R) {
            return {1e18, -1e18};
        }
        double D = 1.0 * R * R - 1.0 * A.y * A.y; // divided by 4
        double x1 = A.x - sqrt(D);
        double x2 = A.x + sqrt(D);
        if(x2 < x1) swap(x1, x2);
        return {x1, x2};
    };
 
    auto good = [&](double R) {
        vector<array<double, 2>> segs(n);
        for(int i = 0; i < n; i++) {
            segs[i] = intersection(p[i], R);
        }
        sort(segs.begin(), segs.end());
        int i = 0;
        double r = 0;
        while(i < n && r >= segs[i][0]) {
            r = max(r, segs[i][1]); i++;
        }
        return r >= L;
    };
 
    double l = 0, r = 4e9;
    while(r - l > eps) {
        double R = (r + l) / 2;
        if(good(R)) {
            r = R;
        }
        else {
            l = R;
        }
    }
    cout << fixed << setprecision(-log10(eps)) << r << endl;
}
 
int main() {
    cin.tie(0)->sync_with_stdio(0);
    double T = 1;
    //cin >> T;
    while(T--) solve();
    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 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 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 348 KB Output is correct
2 Correct 5 ms 572 KB Output is correct
3 Correct 13 ms 348 KB Output is correct
4 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 344 KB Output is correct
2 Correct 10 ms 348 KB Output is correct
3 Correct 7 ms 348 KB Output is correct
4 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 348 KB Output is correct
2 Correct 9 ms 568 KB Output is correct
3 Correct 11 ms 348 KB Output is correct
4 Correct 14 ms 564 KB Output is correct
5 Correct 7 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 2140 KB Output is correct
2 Correct 190 ms 2176 KB Output is correct
3 Correct 172 ms 1628 KB Output is correct
4 Correct 221 ms 2188 KB Output is correct
5 Correct 89 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 2164 KB Output is correct
2 Correct 189 ms 2304 KB Output is correct
3 Correct 167 ms 2352 KB Output is correct
4 Correct 196 ms 2148 KB Output is correct
5 Correct 179 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 100 ms 2396 KB Output is correct
2 Correct 212 ms 2396 KB Output is correct
3 Correct 220 ms 2436 KB Output is correct
4 Correct 218 ms 2648 KB Output is correct
5 Correct 182 ms 2536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 203 ms 2648 KB Output is correct
2 Correct 253 ms 2800 KB Output is correct
3 Correct 243 ms 2652 KB Output is correct
4 Correct 201 ms 2652 KB Output is correct
5 Correct 195 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 141 ms 2804 KB Output is correct
2 Correct 260 ms 2804 KB Output is correct
3 Correct 263 ms 2796 KB Output is correct
4 Correct 243 ms 2652 KB Output is correct
5 Correct 200 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 712 ms 12176 KB Output is correct
2 Execution timed out 1031 ms 14460 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 12176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 902 ms 14544 KB Output is correct
2 Execution timed out 1054 ms 17076 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 14516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 16788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 16752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 19236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 19068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 23888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 24160 KB Time limit exceeded
2 Halted 0 ms 0 KB -