Submission #906170

# Submission time Handle Problem Language Result Execution time Memory
906170 2024-01-13T15:08:15 Z Ludissey Mobile (BOI12_mobile) C++14
100 / 100
292 ms 10724 KB
#include <bits/stdc++.h>
using namespace std;

double dist(double x1, double y1, double x2, double y2){
    double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
    return dist;
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,L; cin >> N >> L;
    vector<pair<int,int>> a;
    for (int i = 0; i < N; i++){
        int x,y; cin >> x >> y;
        y=abs(y);
        if(i>0&&a[a.size()-1].first==x) a[a.size()-1].second=min(a[a.size()-1].second,y);
        else{
            a.push_back({x,y});
        }
    }
    N=a.size();
    double l=0,r=1e9;
    while(r-l>0.0009){
        double mid=(l+r)/2;
        double rght=0;
        for (int i = 0; i <N; i++)
        {
            if(mid<(double)a[i].second) continue;
            double pnt1=a[i].first-sqrt(pow(mid,2)-pow((double)a[i].second,2)),pnt2=(double)a[i].first+sqrt(pow(mid,2)-pow((double)a[i].second,2));
            if(pnt1<=rght) rght=max(rght, pnt2);
        }
        if(rght>=L) {
            r=mid;
        }else{
            l=mid;
        }
    }
    cout << setprecision(3) << fixed << l << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 388 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1500 KB Output is correct
2 Correct 17 ms 992 KB Output is correct
3 Correct 12 ms 992 KB Output is correct
4 Correct 23 ms 1496 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 348 KB Output is correct
2 Correct 14 ms 992 KB Output is correct
3 Correct 18 ms 1500 KB Output is correct
4 Correct 18 ms 1752 KB Output is correct
5 Correct 20 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1500 KB Output is correct
2 Correct 18 ms 992 KB Output is correct
3 Correct 19 ms 1500 KB Output is correct
4 Correct 25 ms 1496 KB Output is correct
5 Correct 16 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 992 KB Output is correct
2 Correct 19 ms 988 KB Output is correct
3 Correct 13 ms 600 KB Output is correct
4 Correct 29 ms 1624 KB Output is correct
5 Correct 22 ms 1752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1504 KB Output is correct
2 Correct 21 ms 988 KB Output is correct
3 Correct 12 ms 604 KB Output is correct
4 Correct 27 ms 1500 KB Output is correct
5 Correct 21 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 5384 KB Output is correct
2 Correct 79 ms 596 KB Output is correct
3 Correct 63 ms 548 KB Output is correct
4 Correct 108 ms 5580 KB Output is correct
5 Correct 100 ms 5544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 552 KB Output is correct
2 Correct 181 ms 6276 KB Output is correct
3 Correct 66 ms 1492 KB Output is correct
4 Correct 111 ms 5324 KB Output is correct
5 Correct 101 ms 4808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 156 ms 10180 KB Output is correct
2 Correct 82 ms 752 KB Output is correct
3 Correct 74 ms 540 KB Output is correct
4 Correct 133 ms 9540 KB Output is correct
5 Correct 105 ms 5068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 544 KB Output is correct
2 Correct 186 ms 9920 KB Output is correct
3 Correct 78 ms 1608 KB Output is correct
4 Correct 146 ms 9000 KB Output is correct
5 Correct 124 ms 10180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 163 ms 10724 KB Output is correct
2 Correct 96 ms 348 KB Output is correct
3 Correct 92 ms 728 KB Output is correct
4 Correct 154 ms 9080 KB Output is correct
5 Correct 113 ms 4920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 468 KB Output is correct
2 Correct 210 ms 9656 KB Output is correct
3 Correct 93 ms 1500 KB Output is correct
4 Correct 151 ms 10428 KB Output is correct
5 Correct 155 ms 9592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 191 ms 9152 KB Output is correct
2 Correct 104 ms 460 KB Output is correct
3 Correct 101 ms 496 KB Output is correct
4 Correct 173 ms 10364 KB Output is correct
5 Correct 149 ms 5528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 117 ms 460 KB Output is correct
2 Correct 237 ms 9664 KB Output is correct
3 Correct 108 ms 1492 KB Output is correct
4 Correct 183 ms 9272 KB Output is correct
5 Correct 158 ms 9032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 234 ms 9472 KB Output is correct
2 Correct 140 ms 720 KB Output is correct
3 Correct 122 ms 480 KB Output is correct
4 Correct 220 ms 10196 KB Output is correct
5 Correct 169 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 136 ms 488 KB Output is correct
2 Correct 292 ms 9412 KB Output is correct
3 Correct 130 ms 2552 KB Output is correct
4 Correct 228 ms 9052 KB Output is correct
5 Correct 226 ms 9924 KB Output is correct