Submission #593027

# Submission time Handle Problem Language Result Execution time Memory
593027 2022-07-10T08:31:28 Z hail Mobile (BOI12_mobile) C++17
25 / 100
1000 ms 109880 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;
pld station[(int)1e6]{};

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

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

    for(int j=0; j<n; j++)
    {
        pld i=station[j];
        if(abs(i.second)<=r)
        {    
            ret_int = intercept(i, r);
            if(ret_int.second<0 || ret_int.first>l) continue;
            else intercepts.insert(ret_int);
        }
    }

    ld start=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;

    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;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 612 KB Output is correct
2 Correct 60 ms 596 KB Output is correct
3 Correct 29 ms 544 KB Output is correct
4 Correct 53 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 852 KB Output is correct
2 Correct 123 ms 852 KB Output is correct
3 Correct 102 ms 908 KB Output is correct
4 Correct 44 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 976 KB Output is correct
2 Correct 123 ms 948 KB Output is correct
3 Correct 102 ms 908 KB Output is correct
4 Correct 40 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 840 KB Output is correct
2 Correct 119 ms 940 KB Output is correct
3 Correct 106 ms 908 KB Output is correct
4 Correct 36 ms 852 KB Output is correct
5 Correct 68 ms 904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 8488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1008 ms 8868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 9832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 11240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 11276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1102 ms 55024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 55116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 65956 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 66004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1102 ms 76964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 77028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 88040 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 88012 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 109880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 97820 KB Time limit exceeded
2 Halted 0 ms 0 KB -