Submission #906162

# Submission time Handle Problem Language Result Execution time Memory
906162 2024-01-13T15:00:43 Z Ludissey Mobile (BOI12_mobile) C++14
100 / 100
819 ms 18964 KB
#include <bits/stdc++.h>
using namespace std;
#define int double
 
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<double,double>> 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();
    int l=0,r=1e10;
    while(r-l>0.0003){
        int mid=(l+r)/2;
        int rght=0;
        for (int i = 0; i < a.size(); i++)
        {
            int pnt1=a[i].first-sqrt(pow(mid,2)-pow(a[i].second,2)),pnt2=a[i].first+sqrt(pow(mid,2)-pow(a[i].second,2));
            if(mid>=a[i].second){
                if(pnt1<=rght) rght=max(rght, pnt2);
            }
        }
        if(rght>=L) {
            r=mid;
        }else{
            l=mid;
        }
    }
    cout << setprecision(5) << fixed << (double)l << "\n";
    return 0;
}
# 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 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 1 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 600 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 5 ms 348 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 600 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 2512 KB Output is correct
2 Correct 36 ms 1500 KB Output is correct
3 Correct 35 ms 1500 KB Output is correct
4 Correct 64 ms 2512 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 600 KB Output is correct
2 Correct 36 ms 1500 KB Output is correct
3 Correct 54 ms 2388 KB Output is correct
4 Correct 63 ms 2512 KB Output is correct
5 Correct 75 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 2516 KB Output is correct
2 Correct 41 ms 1500 KB Output is correct
3 Correct 47 ms 2508 KB Output is correct
4 Correct 103 ms 2508 KB Output is correct
5 Correct 34 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1496 KB Output is correct
2 Correct 42 ms 1488 KB Output is correct
3 Correct 46 ms 808 KB Output is correct
4 Correct 88 ms 2564 KB Output is correct
5 Correct 70 ms 2452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 2520 KB Output is correct
2 Correct 41 ms 1476 KB Output is correct
3 Correct 39 ms 756 KB Output is correct
4 Correct 94 ms 2520 KB Output is correct
5 Correct 69 ms 2512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 268 ms 8640 KB Output is correct
2 Correct 181 ms 816 KB Output is correct
3 Correct 210 ms 632 KB Output is correct
4 Correct 429 ms 10132 KB Output is correct
5 Correct 317 ms 9696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 176 ms 596 KB Output is correct
2 Correct 403 ms 9064 KB Output is correct
3 Correct 182 ms 2528 KB Output is correct
4 Correct 417 ms 9052 KB Output is correct
5 Correct 359 ms 9436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 324 ms 18116 KB Output is correct
2 Correct 203 ms 592 KB Output is correct
3 Correct 212 ms 484 KB Output is correct
4 Correct 532 ms 17084 KB Output is correct
5 Correct 353 ms 9952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 203 ms 668 KB Output is correct
2 Correct 512 ms 18896 KB Output is correct
3 Correct 200 ms 2636 KB Output is correct
4 Correct 579 ms 18496 KB Output is correct
5 Correct 455 ms 17244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 365 ms 18840 KB Output is correct
2 Correct 241 ms 596 KB Output is correct
3 Correct 225 ms 556 KB Output is correct
4 Correct 596 ms 18748 KB Output is correct
5 Correct 338 ms 9588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 242 ms 592 KB Output is correct
2 Correct 532 ms 18100 KB Output is correct
3 Correct 259 ms 2560 KB Output is correct
4 Correct 589 ms 17236 KB Output is correct
5 Correct 513 ms 18540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 401 ms 17244 KB Output is correct
2 Correct 299 ms 596 KB Output is correct
3 Correct 267 ms 628 KB Output is correct
4 Correct 710 ms 17820 KB Output is correct
5 Correct 470 ms 10112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 269 ms 488 KB Output is correct
2 Correct 602 ms 18964 KB Output is correct
3 Correct 268 ms 2552 KB Output is correct
4 Correct 671 ms 16940 KB Output is correct
5 Correct 567 ms 16820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 497 ms 18872 KB Output is correct
2 Correct 329 ms 592 KB Output is correct
3 Correct 325 ms 560 KB Output is correct
4 Correct 806 ms 17108 KB Output is correct
5 Correct 504 ms 9240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 373 ms 792 KB Output is correct
2 Correct 744 ms 17848 KB Output is correct
3 Correct 343 ms 6340 KB Output is correct
4 Correct 819 ms 18368 KB Output is correct
5 Correct 681 ms 17384 KB Output is correct