Submission #862458

# Submission time Handle Problem Language Result Execution time Memory
862458 2023-10-18T09:22:57 Z AndreiVerestiuc Mobile (BOI12_mobile) C++11
90 / 100
1000 ms 50940 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 curr=0;
    for (int i=0; i<n; i++) {
        double x=v[i].first,y=v[i].second;
        double distance=sqrt(d*d-y*y);
        double st=x-distance,dr=x+distance;
        if (st<=curr) curr=max(curr,dr);
    }
    return (curr>=l);
}
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 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 4 ms 580 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 4 ms 580 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 4 ms 600 KB Output is correct
4 Correct 5 ms 604 KB Output is correct
5 Correct 4 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 3516 KB Output is correct
2 Correct 66 ms 3804 KB Output is correct
3 Correct 44 ms 2656 KB Output is correct
4 Correct 73 ms 3924 KB Output is correct
5 Correct 36 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 3236 KB Output is correct
2 Correct 73 ms 3360 KB Output is correct
3 Correct 75 ms 3756 KB Output is correct
4 Correct 86 ms 3928 KB Output is correct
5 Correct 93 ms 4604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3668 KB Output is correct
2 Correct 70 ms 3920 KB Output is correct
3 Correct 67 ms 3924 KB Output is correct
4 Correct 105 ms 5292 KB Output is correct
5 Correct 76 ms 4112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 4432 KB Output is correct
2 Correct 85 ms 4948 KB Output is correct
3 Correct 80 ms 4436 KB Output is correct
4 Correct 113 ms 5432 KB Output is correct
5 Correct 91 ms 4788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 4544 KB Output is correct
2 Correct 85 ms 4944 KB Output is correct
3 Correct 77 ms 4564 KB Output is correct
4 Correct 104 ms 5460 KB Output is correct
5 Correct 89 ms 4680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 375 ms 18888 KB Output is correct
2 Correct 448 ms 20424 KB Output is correct
3 Correct 436 ms 20144 KB Output is correct
4 Correct 526 ms 21420 KB Output is correct
5 Correct 455 ms 22860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 472 ms 21048 KB Output is correct
2 Correct 511 ms 19916 KB Output is correct
3 Correct 404 ms 21812 KB Output is correct
4 Correct 527 ms 25292 KB Output is correct
5 Correct 472 ms 23356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 448 ms 22696 KB Output is correct
2 Correct 566 ms 24288 KB Output is correct
3 Correct 528 ms 27828 KB Output is correct
4 Correct 655 ms 31448 KB Output is correct
5 Correct 550 ms 27060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 548 ms 24500 KB Output is correct
2 Correct 612 ms 23472 KB Output is correct
3 Correct 493 ms 26408 KB Output is correct
4 Correct 629 ms 30904 KB Output is correct
5 Correct 547 ms 27828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 534 ms 25852 KB Output is correct
2 Correct 648 ms 28136 KB Output is correct
3 Correct 631 ms 32504 KB Output is correct
4 Correct 741 ms 35732 KB Output is correct
5 Correct 634 ms 31384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 651 ms 28768 KB Output is correct
2 Correct 705 ms 27540 KB Output is correct
3 Correct 604 ms 30964 KB Output is correct
4 Correct 746 ms 35716 KB Output is correct
5 Correct 656 ms 32408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 592 ms 31352 KB Output is correct
2 Correct 731 ms 35496 KB Output is correct
3 Correct 724 ms 36988 KB Output is correct
4 Correct 869 ms 41356 KB Output is correct
5 Correct 755 ms 36688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 752 ms 36216 KB Output is correct
2 Correct 807 ms 34292 KB Output is correct
3 Correct 679 ms 34964 KB Output is correct
4 Correct 872 ms 40828 KB Output is correct
5 Correct 766 ms 36984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 743 ms 38740 KB Output is correct
2 Correct 896 ms 44120 KB Output is correct
3 Correct 872 ms 46300 KB Output is correct
4 Execution timed out 1057 ms 50940 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 931 ms 44864 KB Output is correct
2 Correct 991 ms 42392 KB Output is correct
3 Correct 833 ms 44120 KB Output is correct
4 Execution timed out 1062 ms 50772 KB Time limit exceeded
5 Halted 0 ms 0 KB -