Submission #553410

# Submission time Handle Problem Language Result Execution time Memory
553410 2022-04-25T19:19:32 Z Hona_Nguyen Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 48116 KB
#include<bits/stdc++.h>
#define prob "mobile"
#define x first
#define y second
using namespace std;
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n,L;
pair<double,double> p[maxn+5];
int main(){
//    freopen(prob".inp","r",stdin);
//    freopen(prob".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n >> L;
    for(int i=1;i<=n;i++) cin >> p[i].x >> p[i].y;
    auto check = [&](double val) -> int{
        vector<pair<double,double>> G;
        for(int i=1;i<=n;i++){
            if(val < p[i].y) return 0;
            double tmp = sqrt(val*val-p[i].y*p[i].y);
            double xL = p[i].x - tmp;
            double xR = p[i].x + tmp;
            G.push_back(make_pair(xL,xR));
        }
        sort(G.begin(),G.end(), [&](const pair<double,double> A, const pair<double,double> B){
             if(A.first == B.first) return A.second < B.second;
             return A.first < B.first;
             });
        double xmaxx = G[0].y;
        double xminn = G[0].x;
        if(G[0].x > 0) return 0;
        for(int i=1;i<n;i++){
            if(G[i].x <= xmaxx){
                xminn = min(xminn,G[i].x);
                xmaxx = max(xmaxx,G[i].y);
            }
        }
        return ((xmaxx >= (double)(L) && (xminn <= 0)));
    };
    double low = 1, high = (double)(2e9), res = 0;
    for(int i=1;i<=100;i++){
        if(high - low < eps) break;
        double mid = (low + high) / (double)(2);
        if(check(mid)){
            res = mid;
            high = mid;
        }
        else{
            low = mid;
        }
    }
    cout << fixed << setprecision(6);
    cout << res;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 628 KB Output is correct
2 Correct 26 ms 612 KB Output is correct
3 Incorrect 18 ms 612 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 253 ms 4852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 388 ms 4848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 384 ms 5184 KB Output is correct
2 Correct 743 ms 5040 KB Output is correct
3 Incorrect 394 ms 5088 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 697 ms 5676 KB Output is correct
2 Correct 931 ms 5516 KB Output is correct
3 Incorrect 493 ms 5532 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 429 ms 5556 KB Output is correct
2 Correct 950 ms 5664 KB Output is correct
3 Incorrect 561 ms 5636 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 24252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 24276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 35604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 35540 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 38688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 38680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 41840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 41840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 48092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 48116 KB Time limit exceeded
2 Halted 0 ms 0 KB -