Submission #593011

# Submission time Handle Problem Language Result Execution time Memory
593011 2022-07-10T07:24:46 Z hail Mobile (BOI12_mobile) C++17
25 / 100
1000 ms 110000 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;
    set<pld> intercepts;

    for(auto i: station)
    {
        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;
    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;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 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 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 596 KB Output is correct
2 Correct 65 ms 596 KB Output is correct
3 Correct 31 ms 468 KB Output is correct
4 Correct 57 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 852 KB Output is correct
2 Correct 129 ms 852 KB Output is correct
3 Correct 113 ms 852 KB Output is correct
4 Correct 55 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 852 KB Output is correct
2 Correct 122 ms 852 KB Output is correct
3 Correct 112 ms 852 KB Output is correct
4 Correct 52 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 108 ms 860 KB Output is correct
2 Correct 123 ms 888 KB Output is correct
3 Correct 107 ms 852 KB Output is correct
4 Correct 49 ms 852 KB Output is correct
5 Correct 77 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 8428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 8772 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 9876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 11272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 11272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 54988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 55196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 65968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 65960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 76912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 77024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 88004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 87960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 110000 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 91436 KB Time limit exceeded
2 Halted 0 ms 0 KB -