Submission #862454

# Submission time Handle Problem Language Result Execution time Memory
862454 2023-10-18T09:15:05 Z AndreiVerestiuc Mobile (BOI12_mobile) C++11
0 / 100
913 ms 47180 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=1e9,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 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 560 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 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 3504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 3212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3596 KB Output is correct
2 Incorrect 70 ms 3632 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 4548 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 4432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 365 ms 18352 KB Output is correct
2 Correct 444 ms 23756 KB Output is correct
3 Correct 458 ms 23228 KB Output is correct
4 Incorrect 475 ms 25912 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 478 ms 20404 KB Output is correct
2 Incorrect 392 ms 22608 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 455 ms 22192 KB Output is correct
2 Incorrect 538 ms 28580 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 555 ms 24244 KB Output is correct
2 Incorrect 478 ms 27220 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 546 ms 25528 KB Output is correct
2 Incorrect 677 ms 33176 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 649 ms 28088 KB Output is correct
2 Incorrect 568 ms 31772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 595 ms 29224 KB Output is correct
2 Incorrect 758 ms 37808 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 785 ms 32188 KB Output is correct
2 Incorrect 661 ms 36284 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 723 ms 36280 KB Output is correct
2 Incorrect 897 ms 47180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 913 ms 40140 KB Output is correct
2 Incorrect 794 ms 44892 KB Output isn't correct
3 Halted 0 ms 0 KB -