Submission #862451

# Submission time Handle Problem Language Result Execution time Memory
862451 2023-10-18T09:11:24 Z AndreiVerestiuc Mobile (BOI12_mobile) C++11
0 / 100
864 ms 48212 KB
#include <bits/stdc++.h>
#define diff 0.00001
#define p pair<double,double>
using namespace std;
bool Check(double d,vector<p> v,int n,int l) {
    double st,dr;
    double distance=sqrt(d*d-v[0].second*v[0].second);
    st=max((double)0,v[0].first-distance);
    dr=min((double)l,v[0].first+distance);

    for (int i=1; i<n; i++) {
        double x=v[i].first,y=v[i].second;
        double distance=sqrt(d*d-y*y);
        if (dr>=max((double)0,x-distance)) dr=min((double)l,x+distance);
        else  return 0;
    }
    return (abs((double)l-dr)<=diff && st<=diff);
}
int main()
{
    int n,l;
    cin>>n>>l;
    vector< p > v(n);
    for (int i=0; i<n; i++)
        cin>>v[i].first>>v[i].second;

    double st=0,dr=100000,mij;
    while (abs(dr-st)>diff) {
        mij=(st+dr)/2;
        //cout<<st<<' '<<dr<<' '<<mij<<'\n';
        if (Check(mij,v,n,l)) dr=mij;
        else  st=mij;
    }
    cout<<fixed<<setprecision(6)<<dr<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 3520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 3496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 3832 KB Output is correct
2 Incorrect 66 ms 3924 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 5052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 4924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 348 ms 20276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 431 ms 24276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 425 ms 24368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 548 ms 29020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 478 ms 28308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 649 ms 33724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 562 ms 32396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 734 ms 38688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 681 ms 40412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 864 ms 48212 KB Output isn't correct
2 Halted 0 ms 0 KB -