Submission #1019417

# Submission time Handle Problem Language Result Execution time Memory
1019417 2024-07-10T19:50:51 Z Thunnus Mobile (BOI12_mobile) C++17
100 / 100
370 ms 35412 KB
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
#define int i64
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define pii pair<int, int>
#define fi first
#define se second
#define sz(x) (int)(x).size()

const double ERROR = 1e-3;
int n, l;

inline bool check(double r, vector<pii> &stations){
    double prev_end = 0;
    for(int i = 0; i < n; i++){
        double a = sqrt(r * r - stations[i].se * stations[i].se);
        double left_endpoint = stations[i].fi - a, right_endpoint = stations[i].fi + a;
        if(left_endpoint <= prev_end)
            prev_end = max(right_endpoint, prev_end);
    }
    return prev_end >= l;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> l;
    vector<pii> stations(n);
    for(pii &p : stations)
        cin >> p.fi >> p.se;

    double lo = 0, hi = 1.5e9, mid;
    while(hi - lo > ERROR){
        mid = (hi + lo) / 2;
        if(check(mid, stations))
            hi = mid;
        else
            lo = mid;
    }
    cout << fixed << setprecision(9) << hi;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 472 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2396 KB Output is correct
2 Correct 18 ms 2652 KB Output is correct
3 Correct 13 ms 1884 KB Output is correct
4 Correct 25 ms 2648 KB Output is correct
5 Correct 14 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2392 KB Output is correct
2 Correct 21 ms 2136 KB Output is correct
3 Correct 30 ms 2652 KB Output is correct
4 Correct 26 ms 2652 KB Output is correct
5 Correct 28 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2396 KB Output is correct
2 Correct 19 ms 2904 KB Output is correct
3 Correct 20 ms 2652 KB Output is correct
4 Correct 36 ms 3932 KB Output is correct
5 Correct 25 ms 2776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3416 KB Output is correct
2 Correct 24 ms 3420 KB Output is correct
3 Correct 23 ms 3044 KB Output is correct
4 Correct 43 ms 3936 KB Output is correct
5 Correct 32 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3420 KB Output is correct
2 Correct 24 ms 3424 KB Output is correct
3 Correct 23 ms 2908 KB Output is correct
4 Correct 35 ms 3928 KB Output is correct
5 Correct 30 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 12496 KB Output is correct
2 Correct 126 ms 15956 KB Output is correct
3 Correct 118 ms 15440 KB Output is correct
4 Correct 180 ms 17744 KB Output is correct
5 Correct 149 ms 14932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 16460 KB Output is correct
2 Correct 202 ms 14676 KB Output is correct
3 Correct 117 ms 13908 KB Output is correct
4 Correct 175 ms 17492 KB Output is correct
5 Correct 140 ms 15440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 133 ms 14928 KB Output is correct
2 Correct 144 ms 18932 KB Output is correct
3 Correct 144 ms 18408 KB Output is correct
4 Correct 208 ms 21588 KB Output is correct
5 Correct 179 ms 17748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 19536 KB Output is correct
2 Correct 220 ms 17744 KB Output is correct
3 Correct 132 ms 16624 KB Output is correct
4 Correct 195 ms 21332 KB Output is correct
5 Correct 178 ms 18512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 155 ms 17420 KB Output is correct
2 Correct 167 ms 22032 KB Output is correct
3 Correct 164 ms 21484 KB Output is correct
4 Correct 223 ms 24800 KB Output is correct
5 Correct 202 ms 20240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 22796 KB Output is correct
2 Correct 266 ms 20560 KB Output is correct
3 Correct 161 ms 19540 KB Output is correct
4 Correct 250 ms 24720 KB Output is correct
5 Correct 210 ms 21388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 19796 KB Output is correct
2 Correct 201 ms 25388 KB Output is correct
3 Correct 185 ms 24480 KB Output is correct
4 Correct 252 ms 28500 KB Output is correct
5 Correct 257 ms 24108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 179 ms 25940 KB Output is correct
2 Correct 292 ms 23376 KB Output is correct
3 Correct 180 ms 22448 KB Output is correct
4 Correct 322 ms 28244 KB Output is correct
5 Correct 246 ms 24512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 24556 KB Output is correct
2 Correct 247 ms 31860 KB Output is correct
3 Correct 226 ms 30560 KB Output is correct
4 Correct 336 ms 35160 KB Output is correct
5 Correct 302 ms 29564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 245 ms 32484 KB Output is correct
2 Correct 347 ms 29296 KB Output is correct
3 Correct 242 ms 28240 KB Output is correct
4 Correct 370 ms 35412 KB Output is correct
5 Correct 309 ms 30800 KB Output is correct