Submission #466093

# Submission time Handle Problem Language Result Execution time Memory
466093 2021-08-17T22:08:34 Z joshualiu555 Mobile (BOI12_mobile) C++14
60 / 100
1000 ms 41164 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(4) << l << '\n';

    return 0;
}

/*
 *
*/

//
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 460 KB Output is correct
2 Correct 7 ms 472 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 8 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 460 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 460 KB Output is correct
2 Correct 5 ms 488 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 10 ms 488 KB Output is correct
5 Correct 7 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 2652 KB Output is correct
2 Correct 72 ms 2628 KB Output is correct
3 Correct 67 ms 1984 KB Output is correct
4 Correct 117 ms 2672 KB Output is correct
5 Correct 75 ms 1816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 2760 KB Output is correct
2 Correct 95 ms 2500 KB Output is correct
3 Correct 113 ms 2740 KB Output is correct
4 Correct 120 ms 2796 KB Output is correct
5 Correct 136 ms 3028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 3032 KB Output is correct
2 Correct 78 ms 2888 KB Output is correct
3 Correct 94 ms 2948 KB Output is correct
4 Correct 169 ms 3448 KB Output is correct
5 Correct 120 ms 3096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 3428 KB Output is correct
2 Correct 93 ms 3436 KB Output is correct
3 Correct 100 ms 3396 KB Output is correct
4 Correct 168 ms 3352 KB Output is correct
5 Correct 161 ms 3356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 118 ms 3396 KB Output is correct
2 Correct 92 ms 3444 KB Output is correct
3 Correct 104 ms 3448 KB Output is correct
4 Correct 200 ms 3472 KB Output is correct
5 Correct 142 ms 3348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 439 ms 15968 KB Output is correct
2 Correct 505 ms 15968 KB Output is correct
3 Correct 490 ms 16084 KB Output is correct
4 Correct 873 ms 15972 KB Output is correct
5 Correct 716 ms 15972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 482 ms 15972 KB Output is correct
2 Correct 656 ms 15968 KB Output is correct
3 Correct 599 ms 15968 KB Output is correct
4 Correct 859 ms 15988 KB Output is correct
5 Correct 779 ms 15968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 528 ms 19160 KB Output is correct
2 Correct 596 ms 19156 KB Output is correct
3 Correct 566 ms 19012 KB Output is correct
4 Execution timed out 1041 ms 19096 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 581 ms 19104 KB Output is correct
2 Correct 798 ms 19096 KB Output is correct
3 Correct 609 ms 19108 KB Output is correct
4 Execution timed out 1026 ms 19104 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 623 ms 22236 KB Output is correct
2 Correct 672 ms 22284 KB Output is correct
3 Correct 671 ms 22172 KB Output is correct
4 Execution timed out 1093 ms 22212 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 690 ms 22152 KB Output is correct
2 Correct 944 ms 22204 KB Output is correct
3 Correct 779 ms 22212 KB Output is correct
4 Execution timed out 1090 ms 22208 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 708 ms 25364 KB Output is correct
2 Correct 773 ms 35032 KB Output is correct
3 Correct 768 ms 36976 KB Output is correct
4 Execution timed out 1090 ms 41164 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 773 ms 25456 KB Output is correct
2 Execution timed out 1047 ms 25464 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 880 ms 31620 KB Output is correct
2 Execution timed out 1008 ms 31684 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 988 ms 31620 KB Output is correct
2 Execution timed out 1090 ms 31568 KB Time limit exceeded
3 Halted 0 ms 0 KB -