답안 #623087

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623087 2022-08-05T07:14:11 Z 54skyxenon Mobile (BOI12_mobile) C++17
100 / 100
608 ms 15980 KB
// https://oj.uz/problem/view/BOI12_mobile

#include <bits/stdc++.h>
using namespace std;

#define EPS 0.001

int n, l;
vector<double> X, Y;

bool ok(double radius) {
    double range = 0;
    
    for (int i = 0; i < n; i++) {
        double term = (radius * radius) - (Y[i] * Y[i]);

        if (term >= 0) {
            double term_sqrt = sqrt(term);
            double range_l = X[i] - term_sqrt;
            double range_r = X[i] + term_sqrt;
            
            if (range_l <= range) {
                range = max<double>(range, range_r);
            }
        }

        if (range >= l) {
            return false;
        }
    }
        
    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> l;

    X.resize(n);
    Y.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> X[i] >> Y[i];
    }

    double lo = 1.0;
    double hi = 2e9;

    while (lo + EPS < hi) {
        double mid = (lo + hi) / 2;

        if (!ok(mid)) {
            hi = mid;
        }
        else {
            lo = mid;
        }
    }

    cout << fixed << setprecision(4) << lo << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 392 KB Output is correct
4 Correct 3 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 1612 KB Output is correct
2 Correct 43 ms 1520 KB Output is correct
3 Correct 26 ms 1108 KB Output is correct
4 Correct 40 ms 1492 KB Output is correct
5 Correct 18 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 1492 KB Output is correct
2 Correct 33 ms 1364 KB Output is correct
3 Correct 38 ms 1492 KB Output is correct
4 Correct 43 ms 1548 KB Output is correct
5 Correct 47 ms 1680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1620 KB Output is correct
2 Correct 41 ms 1600 KB Output is correct
3 Correct 36 ms 1620 KB Output is correct
4 Correct 61 ms 1876 KB Output is correct
5 Correct 36 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 1884 KB Output is correct
2 Correct 51 ms 1888 KB Output is correct
3 Correct 42 ms 1876 KB Output is correct
4 Correct 59 ms 1888 KB Output is correct
5 Correct 50 ms 1888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 1888 KB Output is correct
2 Correct 52 ms 1876 KB Output is correct
3 Correct 45 ms 1876 KB Output is correct
4 Correct 60 ms 1876 KB Output is correct
5 Correct 48 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 231 ms 8148 KB Output is correct
2 Correct 276 ms 8160 KB Output is correct
3 Correct 242 ms 8148 KB Output is correct
4 Correct 282 ms 8148 KB Output is correct
5 Correct 244 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 282 ms 8148 KB Output is correct
2 Correct 308 ms 8148 KB Output is correct
3 Correct 213 ms 8140 KB Output is correct
4 Correct 282 ms 8144 KB Output is correct
5 Correct 248 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 302 ms 9704 KB Output is correct
2 Correct 316 ms 9716 KB Output is correct
3 Correct 307 ms 9684 KB Output is correct
4 Correct 350 ms 9708 KB Output is correct
5 Correct 293 ms 9704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 326 ms 9708 KB Output is correct
2 Correct 384 ms 9708 KB Output is correct
3 Correct 276 ms 9700 KB Output is correct
4 Correct 355 ms 9708 KB Output is correct
5 Correct 288 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 348 ms 11204 KB Output is correct
2 Correct 378 ms 11272 KB Output is correct
3 Correct 367 ms 11272 KB Output is correct
4 Correct 424 ms 11288 KB Output is correct
5 Correct 324 ms 11272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 384 ms 11380 KB Output is correct
2 Correct 427 ms 11280 KB Output is correct
3 Correct 313 ms 11276 KB Output is correct
4 Correct 406 ms 11220 KB Output is correct
5 Correct 348 ms 11340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 369 ms 12836 KB Output is correct
2 Correct 426 ms 12880 KB Output is correct
3 Correct 412 ms 12840 KB Output is correct
4 Correct 474 ms 12756 KB Output is correct
5 Correct 406 ms 12840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 12840 KB Output is correct
2 Correct 485 ms 12840 KB Output is correct
3 Correct 341 ms 12844 KB Output is correct
4 Correct 475 ms 12852 KB Output is correct
5 Correct 389 ms 12840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 472 ms 15968 KB Output is correct
2 Correct 515 ms 15972 KB Output is correct
3 Correct 514 ms 15972 KB Output is correct
4 Correct 586 ms 15976 KB Output is correct
5 Correct 488 ms 15980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 572 ms 15972 KB Output is correct
2 Correct 608 ms 15956 KB Output is correct
3 Correct 469 ms 15976 KB Output is correct
4 Correct 607 ms 15972 KB Output is correct
5 Correct 550 ms 15956 KB Output is correct