답안 #990606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990606 2024-05-30T17:10:50 Z Ska Mobile (BOI12_mobile) C++14
50 / 100
299 ms 6144 KB
#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e5 + 5;
 
int n;
double m;
double x[N], y[N];
 
pair<double, double> calc(double r, int i) {
    if (r < abs(y[i])) {
        return {-1, -1};
    }
    return {x[i] - sqrt(r * r - y[i] * y[i]), x[i] + sqrtl(r * r - y[i] * y[i])};
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    double l = 2e9, r = 1.5e9;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
        l = min(l, abs(y[i]));
    }
    while (r - l >= 1e-3) {
        vector<pair<double, double>> segments;
        double mid = (l + r) / 2;
        for (int i = 1; i <= n; ++i) {
            auto x = calc(mid, i);
            if (x.first != -1 || x.second != -1) {
                segments.emplace_back(x.first, x.second);
            }
        }
        sort(segments.begin(), segments.end());
        double bound = 0;
        for (auto x : segments) {
            if (x.first > bound) {
                break;
            }
            bound = max(bound, x.second);
            if (bound >= m) {
                break;
            }
        }
        if (bound >= m) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << fixed << setprecision(6) << l << '\n';
}
# 결과 실행 시간 메모리 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 1 ms 344 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 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 764 KB Output is correct
2 Correct 6 ms 764 KB Output is correct
3 Correct 9 ms 764 KB Output is correct
4 Correct 6 ms 744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 772 KB Output is correct
2 Correct 7 ms 764 KB Output is correct
3 Correct 9 ms 764 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 756 KB Output is correct
2 Correct 7 ms 764 KB Output is correct
3 Correct 11 ms 764 KB Output is correct
4 Correct 5 ms 732 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 4988 KB Output is correct
2 Correct 192 ms 4928 KB Output is correct
3 Correct 113 ms 3172 KB Output is correct
4 Correct 87 ms 4884 KB Output is correct
5 Correct 75 ms 3064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 5020 KB Output is correct
2 Correct 102 ms 4792 KB Output is correct
3 Correct 106 ms 5032 KB Output is correct
4 Correct 93 ms 5012 KB Output is correct
5 Correct 88 ms 5184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 5944 KB Output is correct
2 Correct 213 ms 5152 KB Output is correct
3 Correct 247 ms 5196 KB Output is correct
4 Correct 77 ms 5564 KB Output is correct
5 Correct 131 ms 5320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 5656 KB Output is correct
2 Correct 275 ms 5644 KB Output is correct
3 Correct 299 ms 5664 KB Output is correct
4 Correct 74 ms 5640 KB Output is correct
5 Correct 133 ms 5656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 5928 KB Output is correct
2 Correct 276 ms 5652 KB Output is correct
3 Correct 289 ms 6144 KB Output is correct
4 Correct 76 ms 5548 KB Output is correct
5 Correct 131 ms 5660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 1872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 1852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 3664 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 3672 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 3668 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -