답안 #990604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990604 2024-05-30T17:07:40 Z Ska Mobile (BOI12_mobile) C++14
50 / 100
981 ms 13800 KB
#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e5 + 5;
 
int n;
long double m;
long double x[N], y[N];
 
pair<long double, long double> calc(long double r, int i) {
    if (r < abs(y[i])) {
        return {-1, -1};
    }
    return {x[i] - sqrtl(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;
    long double l = 2e9, r = 2e9;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
        l = min(l, abs(y[i]));
    }
    int iter = 50;
    while (iter--) {
        vector<pair<long double, long double>> segments;
        long 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());
        long 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 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2796 KB Output is correct
2 Correct 12 ms 2788 KB Output is correct
3 Correct 6 ms 2652 KB Output is correct
4 Correct 10 ms 2812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 3024 KB Output is correct
2 Correct 23 ms 3104 KB Output is correct
3 Correct 39 ms 3056 KB Output is correct
4 Correct 13 ms 3084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 3028 KB Output is correct
2 Correct 23 ms 3084 KB Output is correct
3 Correct 28 ms 3072 KB Output is correct
4 Correct 12 ms 3080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 3188 KB Output is correct
2 Correct 23 ms 3092 KB Output is correct
3 Correct 31 ms 3056 KB Output is correct
4 Correct 12 ms 3080 KB Output is correct
5 Correct 21 ms 3056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 332 ms 11072 KB Output is correct
2 Correct 534 ms 11016 KB Output is correct
3 Correct 366 ms 7220 KB Output is correct
4 Correct 213 ms 12184 KB Output is correct
5 Correct 190 ms 6844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 10904 KB Output is correct
2 Correct 226 ms 10544 KB Output is correct
3 Correct 253 ms 12480 KB Output is correct
4 Correct 225 ms 12352 KB Output is correct
5 Correct 219 ms 11572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 480 ms 10744 KB Output is correct
2 Correct 580 ms 10008 KB Output is correct
3 Correct 782 ms 11100 KB Output is correct
4 Correct 188 ms 13800 KB Output is correct
5 Correct 313 ms 12012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 583 ms 12032 KB Output is correct
2 Correct 735 ms 12696 KB Output is correct
3 Correct 981 ms 11864 KB Output is correct
4 Correct 186 ms 13692 KB Output is correct
5 Correct 302 ms 12732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 532 ms 10864 KB Output is correct
2 Correct 750 ms 12244 KB Output is correct
3 Correct 958 ms 12280 KB Output is correct
4 Correct 172 ms 12664 KB Output is correct
5 Correct 288 ms 12056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 3416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 3416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 3408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -