답안 #593007

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593007 2022-07-10T07:18:38 Z hail Mobile (BOI12_mobile) C++17
25 / 100
1000 ms 83048 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-5)
    {
        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 332 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 352 KB Output is correct
3 Correct 4 ms 324 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 660 KB Output is correct
2 Correct 60 ms 652 KB Output is correct
3 Correct 33 ms 520 KB Output is correct
4 Correct 54 ms 616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 960 KB Output is correct
2 Correct 120 ms 968 KB Output is correct
3 Correct 112 ms 976 KB Output is correct
4 Correct 54 ms 968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 69 ms 940 KB Output is correct
2 Correct 119 ms 968 KB Output is correct
3 Correct 110 ms 952 KB Output is correct
4 Correct 52 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 988 KB Output is correct
2 Correct 120 ms 1068 KB Output is correct
3 Correct 113 ms 952 KB Output is correct
4 Correct 49 ms 992 KB Output is correct
5 Correct 72 ms 932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1078 ms 10004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 10120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 10804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1077 ms 12380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 12256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 52360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 56196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 73520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 78220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1052 ms 77504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1079 ms 83048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 81504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 71552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1078 ms 73376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 81136 KB Time limit exceeded
2 Halted 0 ms 0 KB -