Submission #932366

# Submission time Handle Problem Language Result Execution time Memory
932366 2024-02-23T08:53:47 Z HuyAT Mobile (BOI12_mobile) C++14
4 / 100
1000 ms 31656 KB
#include<bits/stdc++.h>
 
const int MaxN = 1e6 + 10;
const long double Eps = 1e-12;
const long double MaxV = 1e18;
 
int n;
long 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(long double mid){
    long double l = 1e10,r = 1e10;
    bool found = false;
 
    for(int i = 1;i <= n;++i){
        if(mid < y[i]){
            continue;
        }
        long double distance = sqrt(mid * mid - y[i] * y[i]);
        if(!found){
            found = true;
            l = x[i] - distance;
            r = x[i] + distance;
        }else{
            if(r >= x[i] - distance){
                l = std::min(l,x[i] - distance);
                r = std::max(r,x[i] + distance);
            }
        }
    }
    return (l <= 0 && r >= length);
}
long double solve(long double lo,long double hi){
    while(hi - lo > Eps){
        long 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 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Incorrect 1 ms 2468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2396 KB Output is correct
2 Correct 7 ms 2652 KB Output is correct
3 Correct 6 ms 2396 KB Output is correct
4 Correct 8 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2396 KB Output is correct
2 Correct 7 ms 2392 KB Output is correct
3 Correct 7 ms 2392 KB Output is correct
4 Incorrect 8 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 97 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 117 ms 7248 KB Output is correct
2 Correct 113 ms 6792 KB Output is correct
3 Correct 103 ms 6748 KB Output is correct
4 Execution timed out 1089 ms 6800 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 6796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 136 ms 6788 KB Output is correct
2 Correct 179 ms 6788 KB Output is correct
3 Correct 123 ms 6788 KB Output is correct
4 Execution timed out 1018 ms 8028 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 19028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 19076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 23192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 23192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 25240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 25228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 29264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 29336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 31656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 31568 KB Time limit exceeded
2 Halted 0 ms 0 KB -