Submission #732498

# Submission time Handle Problem Language Result Execution time Memory
732498 2023-04-29T05:04:18 Z uy842003 Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 27904 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++) {
            if (!cmp_less_equal(m, abs(cor[i].second))) {
                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)) break;
        }
        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 0 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
# 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 2 ms 340 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 4 ms 212 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 340 KB Output is correct
4 Correct 6 ms 380 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 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 1460 KB Output is correct
2 Correct 92 ms 1492 KB Output is correct
3 Correct 53 ms 1124 KB Output is correct
4 Correct 86 ms 1364 KB Output is correct
5 Correct 54 ms 1080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1492 KB Output is correct
2 Correct 71 ms 1388 KB Output is correct
3 Correct 84 ms 1576 KB Output is correct
4 Correct 92 ms 1492 KB Output is correct
5 Correct 104 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 1620 KB Output is correct
2 Correct 94 ms 1576 KB Output is correct
3 Correct 80 ms 1628 KB Output is correct
4 Correct 133 ms 1844 KB Output is correct
5 Correct 90 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 1856 KB Output is correct
2 Correct 111 ms 1856 KB Output is correct
3 Correct 102 ms 1852 KB Output is correct
4 Correct 144 ms 1852 KB Output is correct
5 Correct 98 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 124 ms 1856 KB Output is correct
2 Correct 133 ms 1852 KB Output is correct
3 Correct 94 ms 1748 KB Output is correct
4 Correct 133 ms 1852 KB Output is correct
5 Correct 105 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 493 ms 8120 KB Output is correct
2 Correct 605 ms 8116 KB Output is correct
3 Correct 541 ms 8116 KB Output is correct
4 Correct 675 ms 8124 KB Output is correct
5 Correct 523 ms 8116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 668 ms 8124 KB Output is correct
2 Correct 593 ms 8120 KB Output is correct
3 Correct 485 ms 8020 KB Output is correct
4 Correct 668 ms 8112 KB Output is correct
5 Correct 556 ms 8116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 580 ms 9688 KB Output is correct
2 Correct 688 ms 9684 KB Output is correct
3 Correct 646 ms 9684 KB Output is correct
4 Correct 771 ms 9684 KB Output is correct
5 Correct 670 ms 9696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 747 ms 9684 KB Output is correct
2 Correct 683 ms 9684 KB Output is correct
3 Correct 607 ms 9684 KB Output is correct
4 Correct 794 ms 9684 KB Output is correct
5 Correct 670 ms 9688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 688 ms 11248 KB Output is correct
2 Correct 815 ms 11244 KB Output is correct
3 Correct 810 ms 11252 KB Output is correct
4 Correct 939 ms 11252 KB Output is correct
5 Correct 756 ms 11248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 860 ms 11248 KB Output is correct
2 Correct 802 ms 11244 KB Output is correct
3 Correct 689 ms 11260 KB Output is correct
4 Correct 953 ms 11248 KB Output is correct
5 Correct 778 ms 11248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 757 ms 12820 KB Output is correct
2 Correct 908 ms 12756 KB Output is correct
3 Correct 903 ms 24316 KB Output is correct
4 Execution timed out 1068 ms 27904 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 12756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 15840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -