Submission #732502

# Submission time Handle Problem Language Result Execution time Memory
732502 2023-04-29T05:05:46 Z uy842003 Mobile (BOI12_mobile) C++17
75 / 100
1000 ms 31420 KB
#include <bits/stdc++.h>
using namespace std;
 
const double eps = 1e-4;
 
inline bool cmp_less(const double &a, const double &b) {
    return a + eps < b;
}
 
inline bool cmp_equal(const double &a, const double &b) {
    return abs(a - b) < eps;
}
 
inline bool cmp_less_equal(const double &a, const double &b) {
    return cmp_less(a, b) || cmp_equal(a, b);
}
 
int main() {
 
    int n;
    double len;
    cin >> n >> len;
    vector<pair<double, double>> cor(n);
    for (int i = 0; i < n; i++)
        cin >> cor[i].first >> cor[i].second;
    double l = 0, r = 4e9 + 1, m;
    while (cmp_less(l, r)) {
        m = (l + r) / 2;
        double cur_pos = 0;
        for (int i = 0; i < n; i++) {
            double dx = sqrt(m * m - cor[i].second * cor[i].second);
            if (cmp_less_equal(cor[i].first - dx, cur_pos)) cur_pos = max(cur_pos, cor[i].first + dx);
        }
        if (cmp_less_equal(len, cur_pos))
            r = m;
        else
            l = m + eps;
    }
    cout << setprecision(3) << fixed << r << endl;
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 2 ms 324 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 372 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 8 ms 340 KB Output is correct
4 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 5 ms 372 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 1464 KB Output is correct
2 Correct 87 ms 1492 KB Output is correct
3 Correct 61 ms 1140 KB Output is correct
4 Correct 95 ms 1464 KB Output is correct
5 Correct 42 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 1516 KB Output is correct
2 Correct 79 ms 1396 KB Output is correct
3 Correct 98 ms 1560 KB Output is correct
4 Correct 122 ms 1528 KB Output is correct
5 Correct 121 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 1668 KB Output is correct
2 Correct 105 ms 1572 KB Output is correct
3 Correct 86 ms 1620 KB Output is correct
4 Correct 184 ms 1848 KB Output is correct
5 Correct 91 ms 1676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 124 ms 1856 KB Output is correct
2 Correct 153 ms 1748 KB Output is correct
3 Correct 97 ms 1748 KB Output is correct
4 Correct 150 ms 1852 KB Output is correct
5 Correct 123 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 148 ms 1876 KB Output is correct
2 Correct 117 ms 1848 KB Output is correct
3 Correct 95 ms 1748 KB Output is correct
4 Correct 179 ms 1748 KB Output is correct
5 Correct 162 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 473 ms 8124 KB Output is correct
2 Correct 621 ms 8116 KB Output is correct
3 Correct 577 ms 8124 KB Output is correct
4 Correct 773 ms 8124 KB Output is correct
5 Correct 600 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 639 ms 8116 KB Output is correct
2 Correct 703 ms 8120 KB Output is correct
3 Correct 489 ms 8116 KB Output is correct
4 Correct 687 ms 8120 KB Output is correct
5 Correct 578 ms 8120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 529 ms 9684 KB Output is correct
2 Correct 727 ms 9684 KB Output is correct
3 Correct 646 ms 9684 KB Output is correct
4 Correct 905 ms 9684 KB Output is correct
5 Correct 735 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 694 ms 9684 KB Output is correct
2 Correct 736 ms 9684 KB Output is correct
3 Correct 618 ms 9804 KB Output is correct
4 Correct 873 ms 9684 KB Output is correct
5 Correct 726 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 610 ms 11252 KB Output is correct
2 Correct 802 ms 11248 KB Output is correct
3 Correct 782 ms 11244 KB Output is correct
4 Execution timed out 1031 ms 11252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 819 ms 11256 KB Output is correct
2 Correct 857 ms 11244 KB Output is correct
3 Correct 690 ms 11244 KB Output is correct
4 Correct 977 ms 11248 KB Output is correct
5 Correct 850 ms 11244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 689 ms 12812 KB Output is correct
2 Correct 910 ms 12816 KB Output is correct
3 Correct 862 ms 12812 KB Output is correct
4 Execution timed out 1079 ms 13196 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 985 ms 12812 KB Output is correct
2 Correct 949 ms 23424 KB Output is correct
3 Correct 788 ms 22280 KB Output is correct
4 Execution timed out 1071 ms 28236 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 827 ms 15956 KB Output is correct
2 Execution timed out 1073 ms 31420 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -