답안 #1056920

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056920 2024-08-13T12:25:19 Z TimAni Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 40384 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 && r >= t) t = r;
        }
        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 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 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 7 ms 584 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 716 KB Output is correct
2 Correct 9 ms 844 KB Output is correct
3 Correct 11 ms 720 KB Output is correct
4 Correct 5 ms 712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 716 KB Output is correct
2 Correct 12 ms 716 KB Output is correct
3 Correct 16 ms 708 KB Output is correct
4 Correct 6 ms 712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 712 KB Output is correct
2 Correct 11 ms 712 KB Output is correct
3 Correct 12 ms 700 KB Output is correct
4 Correct 5 ms 700 KB Output is correct
5 Correct 6 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 4312 KB Output is correct
2 Correct 251 ms 4348 KB Output is correct
3 Correct 142 ms 2760 KB Output is correct
4 Correct 107 ms 4304 KB Output is correct
5 Correct 100 ms 2656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 4368 KB Output is correct
2 Correct 103 ms 4192 KB Output is correct
3 Correct 109 ms 4444 KB Output is correct
4 Correct 93 ms 5176 KB Output is correct
5 Correct 80 ms 4544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 4632 KB Output is correct
2 Correct 319 ms 4456 KB Output is correct
3 Correct 279 ms 4524 KB Output is correct
4 Correct 62 ms 4796 KB Output is correct
5 Correct 139 ms 4516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 260 ms 4896 KB Output is correct
2 Correct 346 ms 4888 KB Output is correct
3 Correct 370 ms 5388 KB Output is correct
4 Correct 64 ms 4792 KB Output is correct
5 Correct 129 ms 4880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 229 ms 4908 KB Output is correct
2 Correct 341 ms 4888 KB Output is correct
3 Correct 384 ms 4876 KB Output is correct
4 Correct 69 ms 4864 KB Output is correct
5 Correct 149 ms 4884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1016 ms 20416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 20416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1042 ms 33932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1069 ms 31652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1018 ms 33704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 33660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1052 ms 36660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 37368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1060 ms 40368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 40384 KB Time limit exceeded
2 Halted 0 ms 0 KB -