Submission #553407

# Submission time Handle Problem Language Result Execution time Memory
553407 2022-04-25T19:12:00 Z Hona_Nguyen Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 48136 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;
        for(int i=1;i<n;i++){
            if(G[i].x > xmaxx) return 0;
            xminn = min(xminn,G[i].x);
            xmaxx = max(xmaxx,G[i].y);
        }
        return 1;
    };
    double low = 0, high = (double)(10e9), 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 0 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 8 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 624 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 820 KB Output is correct
2 Incorrect 14 ms 692 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 227 ms 4820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 362 ms 4840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 355 ms 5180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 468 ms 5652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 418 ms 5552 KB Output is correct
2 Incorrect 466 ms 5532 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 24272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 24236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 35648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 35588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 38724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 38684 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 41988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 41788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 48136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 48080 KB Time limit exceeded
2 Halted 0 ms 0 KB -