답안 #1056921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056921 2024-08-13T12:26:52 Z TimAni Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 41084 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;
        for(int i = 0; i < n; i++) {
            if(abs(p[i].y) > R) continue;
            segs.push_back(intersection(p[i], R));
        }
        if(segs.empty()) return false;
        sort(segs.begin(), segs.end());
        double t = 0;
        for(auto [l, r] : segs) {
            if(l <= t) {
                t = max(t, r);
            }
            else break;
        }
        return t >= 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;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 4 ms 592 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 716 KB Output is correct
2 Correct 9 ms 716 KB Output is correct
3 Correct 11 ms 700 KB Output is correct
4 Correct 6 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 700 KB Output is correct
2 Correct 9 ms 716 KB Output is correct
3 Correct 11 ms 764 KB Output is correct
4 Correct 5 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 828 KB Output is correct
2 Correct 10 ms 712 KB Output is correct
3 Correct 13 ms 700 KB Output is correct
4 Correct 5 ms 732 KB Output is correct
5 Correct 7 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 4352 KB Output is correct
2 Correct 249 ms 4464 KB Output is correct
3 Correct 137 ms 2756 KB Output is correct
4 Correct 85 ms 4280 KB Output is correct
5 Correct 79 ms 2632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 4396 KB Output is correct
2 Correct 109 ms 4192 KB Output is correct
3 Correct 104 ms 4372 KB Output is correct
4 Correct 85 ms 4384 KB Output is correct
5 Correct 81 ms 5268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 195 ms 4888 KB Output is correct
2 Correct 254 ms 4472 KB Output is correct
3 Correct 292 ms 4536 KB Output is correct
4 Correct 67 ms 4800 KB Output is correct
5 Correct 138 ms 4592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 258 ms 4912 KB Output is correct
2 Correct 323 ms 4888 KB Output is correct
3 Correct 353 ms 4868 KB Output is correct
4 Correct 64 ms 4868 KB Output is correct
5 Correct 124 ms 5428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 211 ms 4916 KB Output is correct
2 Correct 335 ms 5028 KB Output is correct
3 Correct 350 ms 4904 KB Output is correct
4 Correct 68 ms 4780 KB Output is correct
5 Correct 143 ms 4872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 20404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1062 ms 20412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 31020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1062 ms 31076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1100 ms 33612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1053 ms 33796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 36152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1034 ms 37392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1029 ms 41084 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 40616 KB Time limit exceeded
2 Halted 0 ms 0 KB -