Submission #973226

# Submission time Handle Problem Language Result Execution time Memory
973226 2024-05-01T16:25:19 Z HuyAT Mobile (BOI12_mobile) C++14
100 / 100
731 ms 16208 KB
#include<bits/stdc++.h>

const int MaxN = 1e6 + 10;
const double Eps = 1e-4;
const double MaxV = 1e9;

int n;
double length,x[MaxN + 1],y[MaxN + 1];

void readData(){
    std::cin >> n >> length;
    for(int i = 1;i <= n;++i){
        std::cin >> x[i] >> y[i];
    }
}
bool f(double mid){
    double l = 0,r = 0;
    for(int i = 1;i <= n;++i){
        if(mid < y[i]){
            continue;
        }
        double distance = sqrt(mid * mid - y[i] * y[i]);
        if(x[i] - distance <= r && x[i] + distance >= l){
            l = std::min(l,x[i] - distance);
            r = std::max(r,x[i] + distance);
        }
    }
    return (l <= 0 && r >= length);
}
double solve(double lo,double hi){
    while(hi - lo > Eps){
        double mid = (lo + hi) / 2;
        if(f(mid)){
            hi = mid;
        }else{
            lo = mid;
        }
//        std::cerr << mid << "\n";
    }
    return hi;
}
int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);std::cout.tie(nullptr);
    readData();
    std::cout << std::fixed << std::setprecision(8) << solve(0,MaxV * 2);
    return 0;
}
# 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 1 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 2392 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 2 ms 2396 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 2 ms 2392 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2396 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 4 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2392 KB Output is correct
4 Correct 4 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2556 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 4 ms 2396 KB Output is correct
5 Correct 3 ms 2556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 6748 KB Output is correct
2 Correct 38 ms 6736 KB Output is correct
3 Correct 25 ms 4700 KB Output is correct
4 Correct 52 ms 6792 KB Output is correct
5 Correct 23 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 6740 KB Output is correct
2 Correct 43 ms 4896 KB Output is correct
3 Correct 55 ms 6792 KB Output is correct
4 Correct 54 ms 6736 KB Output is correct
5 Correct 71 ms 6780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 6740 KB Output is correct
2 Correct 42 ms 6748 KB Output is correct
3 Correct 44 ms 7028 KB Output is correct
4 Correct 72 ms 6776 KB Output is correct
5 Correct 49 ms 6796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 6736 KB Output is correct
2 Correct 57 ms 6780 KB Output is correct
3 Correct 45 ms 6748 KB Output is correct
4 Correct 79 ms 6788 KB Output is correct
5 Correct 63 ms 6740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 6772 KB Output is correct
2 Correct 49 ms 6748 KB Output is correct
3 Correct 44 ms 6740 KB Output is correct
4 Correct 73 ms 6532 KB Output is correct
5 Correct 64 ms 6788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 265 ms 10876 KB Output is correct
2 Correct 250 ms 10836 KB Output is correct
3 Correct 251 ms 10868 KB Output is correct
4 Correct 359 ms 10876 KB Output is correct
5 Correct 326 ms 11096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 252 ms 10880 KB Output is correct
2 Correct 269 ms 10884 KB Output is correct
3 Correct 224 ms 10880 KB Output is correct
4 Correct 352 ms 10876 KB Output is correct
5 Correct 327 ms 10876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 271 ms 14980 KB Output is correct
2 Correct 320 ms 15220 KB Output is correct
3 Correct 311 ms 14932 KB Output is correct
4 Correct 445 ms 14932 KB Output is correct
5 Correct 398 ms 14932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 305 ms 14972 KB Output is correct
2 Correct 319 ms 14928 KB Output is correct
3 Correct 268 ms 14976 KB Output is correct
4 Correct 451 ms 14932 KB Output is correct
5 Correct 391 ms 15184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 318 ms 14932 KB Output is correct
2 Correct 346 ms 15224 KB Output is correct
3 Correct 348 ms 15124 KB Output is correct
4 Correct 518 ms 14988 KB Output is correct
5 Correct 448 ms 15184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 361 ms 14968 KB Output is correct
2 Correct 366 ms 14980 KB Output is correct
3 Correct 324 ms 15220 KB Output is correct
4 Correct 515 ms 14984 KB Output is correct
5 Correct 449 ms 14928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 369 ms 14984 KB Output is correct
2 Correct 403 ms 14932 KB Output is correct
3 Correct 400 ms 14984 KB Output is correct
4 Correct 584 ms 14984 KB Output is correct
5 Correct 507 ms 14928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 407 ms 14988 KB Output is correct
2 Correct 417 ms 14932 KB Output is correct
3 Correct 377 ms 15188 KB Output is correct
4 Correct 601 ms 14988 KB Output is correct
5 Correct 528 ms 14984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 456 ms 16008 KB Output is correct
2 Correct 509 ms 16100 KB Output is correct
3 Correct 515 ms 16040 KB Output is correct
4 Correct 731 ms 16004 KB Output is correct
5 Correct 637 ms 16004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 508 ms 15952 KB Output is correct
2 Correct 527 ms 15956 KB Output is correct
3 Correct 464 ms 16096 KB Output is correct
4 Correct 725 ms 16208 KB Output is correct
5 Correct 669 ms 16088 KB Output is correct