답안 #593455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593455 2022-07-11T08:13:12 Z hail Mobile (BOI12_mobile) C++17
75 / 100
1000 ms 28564 KB
#include <bits/stdc++.h>

using namespace std;

using pld = pair<double, double>;
using ld = double;

#define mp make_pair

int n;
ld l;
vector<pld> station;

pld intercept(pld coor, ld r)
{
    ld mid = pow(r, 2)-pow(coor.second, 2);
    if(mid<0) return mp(-1, -1);
    ld rt_mid = pow(mid , 0.5);
    return mp(coor.first-rt_mid, coor.first+rt_mid);
}

bool check_dist(ld r)
{
    if(r<0) return false;
    pld ret_int;
    ld from_x=0;
    auto it=lower_bound(station.begin(), station.end(), mp(-r, -1e9));
    while(it<station.end())
    {
        if((*it).first>from_x+r) return false;
        ret_int=intercept(*it, r);
        if(ret_int.first<=from_x && ret_int.second>from_x)
        {
            from_x=ret_int.second;
            if(from_x>=l) return true;
            it = upper_bound(it+1, station.end(), mp(from_x-r, 1e9));
        }
        else it++;
    }
    return false;
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cout<<setprecision(20); 

    cin>>n>>l;
    station.resize(n);

    ld max_coor{};

    for(int i=0; i<n; i++)
    {
        cin>>station[i].first>>station[i].second;
        max_coor=max({abs(station[i].first), abs(station[i].second), max_coor});
    }

    ld high=2*(max_coor+l);
    ld low=0;
    ld mid;
    while(high-low>=1e-3)
    {
        mid=(high+low)/2;
        if(check_dist(mid)) high=mid;
        else low=mid;
    }

    cout<<high;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 460 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 448 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 2248 KB Output is correct
2 Correct 43 ms 2516 KB Output is correct
3 Correct 35 ms 1664 KB Output is correct
4 Correct 53 ms 2632 KB Output is correct
5 Correct 19 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 2248 KB Output is correct
2 Correct 32 ms 2172 KB Output is correct
3 Correct 40 ms 2612 KB Output is correct
4 Correct 49 ms 2704 KB Output is correct
5 Correct 50 ms 3060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 161 ms 2252 KB Output is correct
2 Correct 38 ms 2636 KB Output is correct
3 Correct 50 ms 2532 KB Output is correct
4 Correct 59 ms 3772 KB Output is correct
5 Correct 47 ms 2600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 3400 KB Output is correct
2 Correct 49 ms 3288 KB Output is correct
3 Correct 57 ms 2896 KB Output is correct
4 Correct 60 ms 3788 KB Output is correct
5 Correct 47 ms 3016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 3268 KB Output is correct
2 Correct 47 ms 3268 KB Output is correct
3 Correct 57 ms 2904 KB Output is correct
4 Correct 59 ms 3776 KB Output is correct
5 Correct 48 ms 3028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1091 ms 12348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 250 ms 16320 KB Output is correct
2 Correct 465 ms 14652 KB Output is correct
3 Correct 295 ms 13772 KB Output is correct
4 Correct 305 ms 17348 KB Output is correct
5 Correct 255 ms 15432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 14808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 298 ms 19540 KB Output is correct
2 Correct 519 ms 17496 KB Output is correct
3 Correct 356 ms 16472 KB Output is correct
4 Correct 373 ms 20292 KB Output is correct
5 Correct 309 ms 18400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 17276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 368 ms 22664 KB Output is correct
2 Correct 625 ms 20484 KB Output is correct
3 Correct 415 ms 19588 KB Output is correct
4 Correct 450 ms 21092 KB Output is correct
5 Correct 347 ms 21372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 19748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 408 ms 26004 KB Output is correct
2 Correct 753 ms 23316 KB Output is correct
3 Correct 494 ms 22296 KB Output is correct
4 Correct 484 ms 21696 KB Output is correct
5 Correct 429 ms 23176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 24532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 519 ms 28564 KB Output is correct
2 Correct 899 ms 26464 KB Output is correct
3 Correct 678 ms 26192 KB Output is correct
4 Correct 584 ms 16348 KB Output is correct
5 Correct 550 ms 24912 KB Output is correct