답안 #466092

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
466092 2021-08-17T22:08:16 Z joshualiu555 Mobile (BOI12_mobile) C++14
55 / 100
1000 ms 44740 KB
/*
  _____                                     _        _
 / ____|                                   | |      | |
| |  __ _ __ __ _ ___ ___ _   _ _ __   ___ | |_ __ _| |_ ___
| | |_ | '__/ _` / __/ __| | | | '_ \ / _ \| __/ _` | __/ _ \
| |__| | | | (_| \__ \__ \ |_| | |_) | (_) | || (_| | || (_) |
 \_____|_|  \__,_|___/___/\__, | .__/ \___/ \__\__,_|\__\___/
                           __/ | |
                          |___/|_|
*/

#include <fstream>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <array>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <bitset>
#include <string>
#include <sstream>

using namespace std;

using ll = long long;
const int INF = 1e6 + 5;
const int MOD = 1e9 + 7;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

ll N, L;
pair<long double, long double> xy[INF];

bool check (long double radius) {
    vector<pair<long double, long double>> seg;
    long double current = 0;
    for (int i = 0; i < N; i++) {
        long double horz = sqrt(radius * radius - xy[i].second * xy[i].second);
        long double left = xy[i].first - horz, right = xy[i].first + horz;
        if (left <= current) current = max(current, right);
    }
    return current >= L;
}

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

//    ifstream cin(".in");
//    ofstream cout(".out");

    cin >> N >> L;
    for (int i = 0; i < N; i++) cin >> xy[i].first >> xy[i].second;

    long double l = 1, r = 1.5 * 1e9;
    while (r - l > 1e-3) {
        long double m = (l + r) / 2;
        if (check(m)) {
            r = m;
        } else {
            l = m;
        }
    }

    cout << fixed << setprecision(3) << l << '\n';

    return 0;
}

/*
 *
*/

//
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 460 KB Output is correct
2 Correct 7 ms 476 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 460 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 8 ms 488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 460 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 5 ms 484 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
5 Correct 7 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 2660 KB Output is correct
2 Correct 71 ms 2712 KB Output is correct
3 Correct 54 ms 1932 KB Output is correct
4 Correct 115 ms 2732 KB Output is correct
5 Correct 57 ms 1876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 107 ms 2756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 89 ms 3060 KB Output is correct
2 Correct 76 ms 2776 KB Output is correct
3 Correct 86 ms 2964 KB Output is correct
4 Correct 167 ms 3392 KB Output is correct
5 Correct 115 ms 3216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 3320 KB Output is correct
2 Correct 97 ms 3428 KB Output is correct
3 Correct 100 ms 3448 KB Output is correct
4 Correct 173 ms 3448 KB Output is correct
5 Correct 136 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 3396 KB Output is correct
2 Correct 94 ms 3500 KB Output is correct
3 Correct 98 ms 3440 KB Output is correct
4 Correct 168 ms 3444 KB Output is correct
5 Correct 140 ms 3328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 443 ms 16068 KB Output is correct
2 Correct 471 ms 15884 KB Output is correct
3 Correct 490 ms 15968 KB Output is correct
4 Correct 850 ms 16064 KB Output is correct
5 Correct 734 ms 16000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 503 ms 16216 KB Output is correct
2 Correct 645 ms 15988 KB Output is correct
3 Correct 512 ms 16020 KB Output is correct
4 Correct 826 ms 16064 KB Output is correct
5 Correct 741 ms 16012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 548 ms 19104 KB Output is correct
2 Correct 604 ms 19012 KB Output is correct
3 Correct 568 ms 19144 KB Output is correct
4 Execution timed out 1018 ms 19136 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 582 ms 19104 KB Output is correct
2 Correct 807 ms 19132 KB Output is correct
3 Correct 634 ms 19100 KB Output is correct
4 Execution timed out 1066 ms 19104 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 670 ms 22224 KB Output is correct
2 Correct 702 ms 22232 KB Output is correct
3 Incorrect 677 ms 22232 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 705 ms 22120 KB Output is correct
2 Correct 929 ms 22232 KB Output is correct
3 Correct 760 ms 30608 KB Output is correct
4 Execution timed out 1089 ms 35520 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 726 ms 25364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 802 ms 25396 KB Output is correct
2 Execution timed out 1077 ms 35924 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 930 ms 31616 KB Output is correct
2 Execution timed out 1064 ms 41092 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 966 ms 31616 KB Output is correct
2 Execution timed out 1088 ms 44740 KB Time limit exceeded
3 Halted 0 ms 0 KB -