Submission #906166

# Submission time Handle Problem Language Result Execution time Memory
906166 2024-01-13T15:04:38 Z Ludissey Mobile (BOI12_mobile) C++14
100 / 100
292 ms 10852 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 < a.size(); 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;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for (int i = 0; i < a.size(); i++)
      |                         ~~^~~~~~~~~~
# 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 0 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 600 KB Output is correct
2 Correct 1 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 2 ms 348 KB Output is correct
2 Correct 3 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 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 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1496 KB Output is correct
2 Correct 17 ms 992 KB Output is correct
3 Correct 13 ms 992 KB Output is correct
4 Correct 18 ms 1500 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 13 ms 992 KB Output is correct
3 Correct 22 ms 1500 KB Output is correct
4 Correct 18 ms 1500 KB Output is correct
5 Correct 19 ms 1500 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 19 ms 1500 KB Output is correct
4 Correct 23 ms 1500 KB Output is correct
5 Correct 13 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 988 KB Output is correct
2 Correct 18 ms 988 KB Output is correct
3 Correct 14 ms 488 KB Output is correct
4 Correct 23 ms 1496 KB Output is correct
5 Correct 20 ms 1380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1500 KB Output is correct
2 Correct 18 ms 992 KB Output is correct
3 Correct 13 ms 600 KB Output is correct
4 Correct 23 ms 1496 KB Output is correct
5 Correct 24 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 5588 KB Output is correct
2 Correct 64 ms 552 KB Output is correct
3 Correct 63 ms 592 KB Output is correct
4 Correct 113 ms 5320 KB Output is correct
5 Correct 96 ms 5832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 504 KB Output is correct
2 Correct 158 ms 4552 KB Output is correct
3 Correct 66 ms 1488 KB Output is correct
4 Correct 109 ms 5828 KB Output is correct
5 Correct 103 ms 5488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 157 ms 10180 KB Output is correct
2 Correct 96 ms 484 KB Output is correct
3 Correct 73 ms 348 KB Output is correct
4 Correct 147 ms 10692 KB Output is correct
5 Correct 107 ms 6636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 344 KB Output is correct
2 Correct 195 ms 9564 KB Output is correct
3 Correct 73 ms 1540 KB Output is correct
4 Correct 137 ms 10852 KB Output is correct
5 Correct 131 ms 10688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 8640 KB Output is correct
2 Correct 96 ms 596 KB Output is correct
3 Correct 88 ms 480 KB Output is correct
4 Correct 156 ms 9404 KB Output is correct
5 Correct 133 ms 5576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 536 KB Output is correct
2 Correct 215 ms 9000 KB Output is correct
3 Correct 105 ms 1492 KB Output is correct
4 Correct 162 ms 10512 KB Output is correct
5 Correct 140 ms 9932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 8960 KB Output is correct
2 Correct 108 ms 536 KB Output is correct
3 Correct 99 ms 492 KB Output is correct
4 Correct 176 ms 9712 KB Output is correct
5 Correct 146 ms 6032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 344 KB Output is correct
2 Correct 231 ms 10168 KB Output is correct
3 Correct 104 ms 1488 KB Output is correct
4 Correct 210 ms 9916 KB Output is correct
5 Correct 158 ms 10692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 231 ms 9472 KB Output is correct
2 Correct 128 ms 480 KB Output is correct
3 Correct 132 ms 464 KB Output is correct
4 Correct 215 ms 9632 KB Output is correct
5 Correct 170 ms 5572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 348 KB Output is correct
2 Correct 292 ms 9660 KB Output is correct
3 Correct 131 ms 2508 KB Output is correct
4 Correct 220 ms 9636 KB Output is correct
5 Correct 204 ms 10136 KB Output is correct