답안 #906178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906178 2024-01-13T15:11:43 Z Ludissey Mobile (BOI12_mobile) C++14
100 / 100
312 ms 10788 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;
    double toO=1e9,toL=1e9;
    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});
        }
        toO=min(dist(0,0,x,y),toO);
        toL=min(dist(L,0,x,y),toL);
    }
    N=a.size();
    double l=max(toO,toL),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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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
# 결과 실행 시간 메모리 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 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1500 KB Output is correct
2 Correct 18 ms 992 KB Output is correct
3 Correct 14 ms 992 KB Output is correct
4 Correct 18 ms 1524 KB Output is correct
5 Correct 6 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 476 KB Output is correct
2 Correct 13 ms 992 KB Output is correct
3 Correct 17 ms 1624 KB Output is correct
4 Correct 18 ms 1496 KB Output is correct
5 Correct 20 ms 1496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1752 KB Output is correct
2 Correct 18 ms 988 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 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 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 23 ms 1500 KB Output is correct
5 Correct 21 ms 1496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 1496 KB Output is correct
2 Correct 19 ms 1088 KB Output is correct
3 Correct 21 ms 584 KB Output is correct
4 Correct 24 ms 1496 KB Output is correct
5 Correct 21 ms 1500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 6352 KB Output is correct
2 Correct 67 ms 576 KB Output is correct
3 Correct 64 ms 592 KB Output is correct
4 Correct 142 ms 5316 KB Output is correct
5 Correct 98 ms 5068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 548 KB Output is correct
2 Correct 176 ms 4816 KB Output is correct
3 Correct 73 ms 1524 KB Output is correct
4 Correct 112 ms 6368 KB Output is correct
5 Correct 119 ms 6320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 9412 KB Output is correct
2 Correct 79 ms 348 KB Output is correct
3 Correct 77 ms 552 KB Output is correct
4 Correct 134 ms 10432 KB Output is correct
5 Correct 110 ms 5572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 348 KB Output is correct
2 Correct 195 ms 9664 KB Output is correct
3 Correct 74 ms 1540 KB Output is correct
4 Correct 134 ms 9096 KB Output is correct
5 Correct 129 ms 9664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 164 ms 10636 KB Output is correct
2 Correct 94 ms 544 KB Output is correct
3 Correct 96 ms 632 KB Output is correct
4 Correct 154 ms 9180 KB Output is correct
5 Correct 120 ms 5880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 99 ms 348 KB Output is correct
2 Correct 231 ms 9760 KB Output is correct
3 Correct 96 ms 1492 KB Output is correct
4 Correct 162 ms 10068 KB Output is correct
5 Correct 167 ms 9668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 9896 KB Output is correct
2 Correct 104 ms 492 KB Output is correct
3 Correct 160 ms 348 KB Output is correct
4 Correct 191 ms 9684 KB Output is correct
5 Correct 167 ms 6088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 111 ms 492 KB Output is correct
2 Correct 267 ms 10692 KB Output is correct
3 Correct 108 ms 1508 KB Output is correct
4 Correct 208 ms 10648 KB Output is correct
5 Correct 179 ms 9296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 10464 KB Output is correct
2 Correct 129 ms 344 KB Output is correct
3 Correct 132 ms 464 KB Output is correct
4 Correct 225 ms 8640 KB Output is correct
5 Correct 184 ms 6420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 488 KB Output is correct
2 Correct 312 ms 8640 KB Output is correct
3 Correct 156 ms 2620 KB Output is correct
4 Correct 241 ms 10788 KB Output is correct
5 Correct 206 ms 10172 KB Output is correct