답안 #465867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465867 2021-08-17T03:38:05 Z joshualiu555 Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 48140 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};

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

bool check (double radius) {
    vector<pair<double, double>> segments;
    for (int i = 0; i < N; i++) {
        double left = xy[i].first - sqrt(pow(radius, 2) - pow(xy[i].second, 2));
        double right = xy[i].first + sqrt(pow(radius, 2) - pow(xy[i].second, 2));
        segments.push_back(make_pair(left, right));
    }
    sort(segments.begin(), segments.end());
    double search = 0;
    for (int i = 0; i < N; i++) {
        if (segments[i].first <= search + 1e-4 && search <= segments[i].second - 1e-4) {
            search = segments[i].second;
        }
    }
    return search >= 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;
    }

    double l = 0, r = 1.5 * 1e9;
    for (int i = 0; i < 100; i++) {
        double m = (l + r) / 2;
        if (check(m)) {
            r = m;
        } else {
            l = m;
        }
    }

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

    return 0;
}

/*
 *
*/

//2 10
//0 0
//11 1
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 604 KB Output is correct
2 Correct 24 ms 620 KB Output is correct
3 Correct 31 ms 604 KB Output is correct
4 Incorrect 39 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 768 ms 4748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 597 ms 5048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 489 ms 5188 KB Output is correct
2 Correct 727 ms 5044 KB Output is correct
3 Correct 767 ms 5100 KB Output is correct
4 Incorrect 765 ms 5792 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 715 ms 5520 KB Output is correct
2 Correct 986 ms 5600 KB Output is correct
3 Correct 857 ms 5592 KB Output is correct
4 Incorrect 903 ms 5556 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 564 ms 5556 KB Output is correct
2 Correct 929 ms 5576 KB Output is correct
3 Correct 833 ms 5700 KB Output is correct
4 Incorrect 803 ms 5572 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1058 ms 24272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 24444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 35648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 35560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1078 ms 38752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 38740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 42020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1089 ms 42000 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 48140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1084 ms 48028 KB Time limit exceeded
2 Halted 0 ms 0 KB -