Submission #593246

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

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

    ld high=2e9;
    ld low=-2e3;
    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 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 320 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 2 ms 340 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 3 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 440 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1612 KB Output is correct
2 Correct 35 ms 1708 KB Output is correct
3 Correct 32 ms 1236 KB Output is correct
4 Correct 45 ms 1608 KB Output is correct
5 Correct 23 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1620 KB Output is correct
2 Correct 34 ms 1576 KB Output is correct
3 Correct 39 ms 1800 KB Output is correct
4 Correct 46 ms 1784 KB Output is correct
5 Correct 48 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 163 ms 1748 KB Output is correct
2 Correct 41 ms 1732 KB Output is correct
3 Correct 52 ms 1880 KB Output is correct
4 Correct 60 ms 1996 KB Output is correct
5 Correct 37 ms 1748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 2036 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 119 ms 2052 KB Output is correct
2 Correct 50 ms 2056 KB Output is correct
3 Correct 64 ms 2064 KB Output is correct
4 Correct 59 ms 2004 KB Output is correct
5 Correct 48 ms 1992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 8284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 241 ms 8416 KB Output is correct
2 Correct 443 ms 8392 KB Output is correct
3 Correct 312 ms 8760 KB Output is correct
4 Correct 276 ms 8796 KB Output is correct
5 Correct 249 ms 8928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 9988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 282 ms 10272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 11656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 334 ms 11852 KB Output is correct
2 Correct 580 ms 11524 KB Output is correct
3 Correct 433 ms 11980 KB Output is correct
4 Correct 412 ms 11996 KB Output is correct
5 Correct 342 ms 11980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 13292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 385 ms 13348 KB Output is correct
2 Correct 698 ms 13200 KB Output is correct
3 Correct 512 ms 13608 KB Output is correct
4 Correct 463 ms 13524 KB Output is correct
5 Correct 404 ms 13488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1028 ms 16580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 509 ms 16480 KB Output is correct
2 Correct 869 ms 16332 KB Output is correct
3 Correct 648 ms 16704 KB Output is correct
4 Correct 575 ms 15956 KB Output is correct
5 Correct 497 ms 16476 KB Output is correct