답안 #715667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
715667 2023-03-27T13:00:28 Z MilosMilutinovic Mobile (BOI12_mobile) C++14
100 / 100
891 ms 27488 KB
#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, L;
    std::cin >> n >> L;

    std::vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i] >> y[i];
    }

    const double eps = 1E-4;

    std::function<bool(double)> check = [&](double r) {
        double f = 0;
        for (int i = 0; i < n; i++) {
            if (r * r >= (long double) y[i] * y[i]) {
                double p = std::sqrt(r * r - (long double) y[i] * y[i]);
                if (x[i] - p <= f) {
                    f = std::max(f, x[i] + p);
                }
            }
        }
        return f >= L;
    };

    double low = 0, high = 2E9, ans = -1;
    for (int i = 0; i < 100; i++) {
        double mid = (low + high) / 2;
        if (check(mid)) {
            ans = mid;
            high = mid;
        } else {
            low = mid;
        }
    }

    std::cout << std::fixed << std::setprecision(10) << ans << "\n";

    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:17:18: warning: unused variable 'eps' [-Wunused-variable]
   17 |     const double eps = 1E-4;
      |                  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 6 ms 364 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 240 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 904 KB Output is correct
2 Correct 45 ms 924 KB Output is correct
3 Correct 28 ms 724 KB Output is correct
4 Correct 30 ms 920 KB Output is correct
5 Correct 19 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 928 KB Output is correct
2 Correct 27 ms 852 KB Output is correct
3 Correct 30 ms 852 KB Output is correct
4 Correct 49 ms 852 KB Output is correct
5 Correct 36 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 996 KB Output is correct
2 Correct 46 ms 852 KB Output is correct
3 Correct 43 ms 1100 KB Output is correct
4 Correct 38 ms 1108 KB Output is correct
5 Correct 33 ms 1012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 1108 KB Output is correct
2 Correct 66 ms 1108 KB Output is correct
3 Correct 49 ms 1108 KB Output is correct
4 Correct 38 ms 1108 KB Output is correct
5 Correct 33 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 1108 KB Output is correct
2 Correct 57 ms 1108 KB Output is correct
3 Correct 47 ms 1108 KB Output is correct
4 Correct 34 ms 1108 KB Output is correct
5 Correct 33 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 274 ms 4180 KB Output is correct
2 Correct 285 ms 4228 KB Output is correct
3 Correct 288 ms 4228 KB Output is correct
4 Correct 161 ms 4228 KB Output is correct
5 Correct 160 ms 4180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 288 ms 4180 KB Output is correct
2 Correct 545 ms 4232 KB Output is correct
3 Correct 235 ms 9932 KB Output is correct
4 Correct 170 ms 13564 KB Output is correct
5 Correct 166 ms 11588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 319 ms 5004 KB Output is correct
2 Correct 351 ms 5008 KB Output is correct
3 Correct 338 ms 5020 KB Output is correct
4 Correct 201 ms 5008 KB Output is correct
5 Correct 190 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 342 ms 5016 KB Output is correct
2 Correct 632 ms 5008 KB Output is correct
3 Correct 300 ms 11800 KB Output is correct
4 Correct 205 ms 16648 KB Output is correct
5 Correct 202 ms 13716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 370 ms 5716 KB Output is correct
2 Correct 395 ms 5796 KB Output is correct
3 Correct 427 ms 5836 KB Output is correct
4 Correct 235 ms 5836 KB Output is correct
5 Correct 233 ms 5792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 394 ms 5788 KB Output is correct
2 Correct 666 ms 5792 KB Output is correct
3 Correct 336 ms 14188 KB Output is correct
4 Correct 237 ms 19148 KB Output is correct
5 Correct 242 ms 15928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 429 ms 6580 KB Output is correct
2 Correct 442 ms 6592 KB Output is correct
3 Correct 458 ms 6604 KB Output is correct
4 Correct 260 ms 6484 KB Output is correct
5 Correct 270 ms 6584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 474 ms 6580 KB Output is correct
2 Correct 741 ms 6588 KB Output is correct
3 Correct 379 ms 16052 KB Output is correct
4 Correct 271 ms 22072 KB Output is correct
5 Correct 264 ms 18124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 549 ms 8148 KB Output is correct
2 Correct 571 ms 8148 KB Output is correct
3 Correct 552 ms 8160 KB Output is correct
4 Correct 335 ms 8148 KB Output is correct
5 Correct 365 ms 21704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 608 ms 8148 KB Output is correct
2 Correct 891 ms 8148 KB Output is correct
3 Correct 495 ms 20424 KB Output is correct
4 Correct 340 ms 27488 KB Output is correct
5 Correct 328 ms 22876 KB Output is correct