답안 #593009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593009 2022-07-10T07:20:45 Z hail Mobile (BOI12_mobile) C++17
25 / 100
1000 ms 74840 KB
#include <bits/stdc++.h>

using namespace std;

using pld = pair<long double, long double>;
using ld = long 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);
    ld rt_mid = pow(mid, 0.5);
    if (mid<0) return mp(-1, -1);
    else return mp(coor.first-rt_mid, coor.first+rt_mid);
}

bool check_dist(ld r)
{
    pld ret_int;
    vector<pld> intercepts(0);

    for(auto i: station)
    {
        ret_int = intercept(i, r);
        if(ret_int.second<0 || ret_int.first>l) continue;
        else intercepts.push_back(ret_int);
    }

    ld start=0;


    sort(intercepts.begin(), intercepts.end());

    int pos[0];

    for(auto i: intercepts)
    {
        if(i.first>start) return false;
        else start= max(start, i.second);
        if(start>=l) return true;
    }

    return false;
}


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

    cout<<setprecision(11);

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

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

    ld high=2e9;
    ld low=0;
    ld mid;
    while(high-low>1e-4)
    {
        mid=(high+low)/2;
        if(check_dist(mid)) high=mid;
        else low=mid;
    }

    cout<<high;

}

Compilation message

mobile.cpp: In function 'bool check_dist(ld)':
mobile.cpp:39:9: warning: unused variable 'pos' [-Wunused-variable]
   39 |     int pos[0];
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 628 KB Output is correct
2 Correct 58 ms 648 KB Output is correct
3 Correct 29 ms 468 KB Output is correct
4 Correct 49 ms 648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 952 KB Output is correct
2 Correct 111 ms 1016 KB Output is correct
3 Correct 106 ms 952 KB Output is correct
4 Correct 53 ms 1020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 952 KB Output is correct
2 Correct 111 ms 960 KB Output is correct
3 Correct 103 ms 952 KB Output is correct
4 Correct 53 ms 968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 101 ms 1008 KB Output is correct
2 Correct 112 ms 964 KB Output is correct
3 Correct 107 ms 952 KB Output is correct
4 Correct 48 ms 968 KB Output is correct
5 Correct 72 ms 944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 9284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1062 ms 9520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 10152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 10872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 10784 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 48156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 48128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1078 ms 68496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1054 ms 68480 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1089 ms 71528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 71580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 74840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 58472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 64780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 64584 KB Time limit exceeded
2 Halted 0 ms 0 KB -