Submission #593247

# Submission time Handle Problem Language Result Execution time Memory
593247 2022-07-10T16:30:43 Z hail Mobile (BOI12_mobile) C++17
65 / 100
1000 ms 15964 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(11);

    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=max_coor+l;
    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 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 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 1 ms 340 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 396 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1492 KB Output is correct
2 Correct 34 ms 1492 KB Output is correct
3 Correct 31 ms 1108 KB Output is correct
4 Correct 41 ms 1492 KB Output is correct
5 Correct 19 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1492 KB Output is correct
2 Correct 32 ms 1364 KB Output is correct
3 Correct 37 ms 1492 KB Output is correct
4 Correct 47 ms 1492 KB Output is correct
5 Correct 48 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 1620 KB Output is correct
2 Correct 37 ms 1492 KB Output is correct
3 Correct 52 ms 1620 KB Output is correct
4 Correct 60 ms 1876 KB Output is correct
5 Correct 37 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 115 ms 1876 KB Output is correct
2 Correct 45 ms 1876 KB Output is correct
3 Correct 58 ms 1876 KB Output is correct
4 Correct 57 ms 1876 KB Output is correct
5 Correct 53 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 8148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 242 ms 8148 KB Output is correct
2 Correct 451 ms 8148 KB Output is correct
3 Correct 309 ms 8148 KB Output is correct
4 Correct 292 ms 8148 KB Output is correct
5 Correct 253 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 9680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 289 ms 9684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 11220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 340 ms 11220 KB Output is correct
2 Correct 591 ms 11220 KB Output is correct
3 Correct 419 ms 11220 KB Output is correct
4 Correct 401 ms 11220 KB Output is correct
5 Correct 336 ms 11220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 12756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 388 ms 12756 KB Output is correct
2 Correct 699 ms 12756 KB Output is correct
3 Correct 481 ms 12756 KB Output is correct
4 Correct 486 ms 12756 KB Output is correct
5 Correct 381 ms 12756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 15924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 475 ms 15956 KB Output is correct
2 Correct 881 ms 15944 KB Output is correct
3 Correct 616 ms 15956 KB Output is correct
4 Correct 576 ms 15964 KB Output is correct
5 Correct 489 ms 15912 KB Output is correct