Submission #973171

# Submission time Handle Problem Language Result Execution time Memory
973171 2024-05-01T15:06:40 Z jadai007 Mobile (BOI12_mobile) C++17
100 / 100
674 ms 48352 KB
#include<bits/stdc++.h>

using namespace std;

int n;
double L, x[1000100], y[1000100], l = 0, r = 1e9;
vector<pair<double, double>> vc;

bool solve(double mid){
    vc.clear();
    double ans = 0.0;
    for(int i = 1; i <= n; i++) {
        double dis = sqrt(mid*mid - y[i]*y[i]);
        vc.emplace_back(x[i] - dis, x[i] + dis);
    }
    for(auto x: vc) if(x.first <= ans) ans = max(ans, x.second);
    return ans >= L;
}

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n >> L;
    for(int i = 1; i<=n; ++i) cin >> x[i] >> y[i];
    while(l + 0.0001 < r){
        double mid = (l + r) / 2;
        if(solve(mid)) r = mid;
        else l = mid + 0.0001;
    }
    cout << fixed << setprecision(6) << l;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2648 KB Output is correct
2 Correct 3 ms 2652 KB Output is correct
3 Correct 3 ms 2652 KB Output is correct
4 Correct 3 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2648 KB Output is correct
2 Correct 3 ms 2652 KB Output is correct
3 Correct 3 ms 2652 KB Output is correct
4 Correct 4 ms 2780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2648 KB Output is correct
2 Correct 4 ms 2904 KB Output is correct
3 Correct 3 ms 2908 KB Output is correct
4 Correct 4 ms 2652 KB Output is correct
5 Correct 3 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 9488 KB Output is correct
2 Correct 39 ms 9988 KB Output is correct
3 Correct 28 ms 6604 KB Output is correct
4 Correct 51 ms 10076 KB Output is correct
5 Correct 31 ms 6380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 9676 KB Output is correct
2 Correct 50 ms 7636 KB Output is correct
3 Correct 45 ms 9964 KB Output is correct
4 Correct 51 ms 9936 KB Output is correct
5 Correct 58 ms 10448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 9420 KB Output is correct
2 Correct 43 ms 9936 KB Output is correct
3 Correct 42 ms 9612 KB Output is correct
4 Correct 60 ms 10148 KB Output is correct
5 Correct 47 ms 9688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 10184 KB Output is correct
2 Correct 50 ms 9932 KB Output is correct
3 Correct 49 ms 9672 KB Output is correct
4 Correct 61 ms 10192 KB Output is correct
5 Correct 54 ms 10188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 10188 KB Output is correct
2 Correct 51 ms 10200 KB Output is correct
3 Correct 48 ms 9944 KB Output is correct
4 Correct 62 ms 10704 KB Output is correct
5 Correct 55 ms 10188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 242 ms 22424 KB Output is correct
2 Correct 265 ms 25332 KB Output is correct
3 Correct 284 ms 24268 KB Output is correct
4 Correct 294 ms 25564 KB Output is correct
5 Correct 285 ms 24820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 253 ms 24136 KB Output is correct
2 Correct 359 ms 23536 KB Output is correct
3 Correct 245 ms 25028 KB Output is correct
4 Correct 293 ms 27672 KB Output is correct
5 Correct 280 ms 26052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 335 ms 36060 KB Output is correct
2 Correct 312 ms 36972 KB Output is correct
3 Correct 330 ms 37316 KB Output is correct
4 Correct 389 ms 39652 KB Output is correct
5 Correct 346 ms 38596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 325 ms 39072 KB Output is correct
2 Correct 404 ms 36020 KB Output is correct
3 Correct 328 ms 37988 KB Output is correct
4 Correct 362 ms 42224 KB Output is correct
5 Correct 364 ms 38976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 36124 KB Output is correct
2 Correct 366 ms 38500 KB Output is correct
3 Correct 362 ms 38336 KB Output is correct
4 Correct 428 ms 38996 KB Output is correct
5 Correct 403 ms 40440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 373 ms 38832 KB Output is correct
2 Correct 496 ms 38756 KB Output is correct
3 Correct 396 ms 39896 KB Output is correct
4 Correct 424 ms 44228 KB Output is correct
5 Correct 403 ms 40128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 383 ms 35524 KB Output is correct
2 Correct 433 ms 40164 KB Output is correct
3 Correct 446 ms 38908 KB Output is correct
4 Correct 486 ms 40900 KB Output is correct
5 Correct 468 ms 42216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 474 ms 38508 KB Output is correct
2 Correct 519 ms 37368 KB Output is correct
3 Correct 398 ms 40284 KB Output is correct
4 Correct 505 ms 45272 KB Output is correct
5 Correct 457 ms 41156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 477 ms 38088 KB Output is correct
2 Correct 551 ms 41924 KB Output is correct
3 Correct 517 ms 41496 KB Output is correct
4 Correct 627 ms 42708 KB Output is correct
5 Correct 579 ms 43240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 543 ms 43088 KB Output is correct
2 Correct 674 ms 41172 KB Output is correct
3 Correct 504 ms 42984 KB Output is correct
4 Correct 604 ms 48352 KB Output is correct
5 Correct 586 ms 45252 KB Output is correct