Submission #593066

# Submission time Handle Problem Language Result Execution time Memory
593066 2022-07-10T10:37:42 Z hail Mobile (BOI12_mobile) C++17
45 / 100
1000 ms 49832 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 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;
    vector<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.push_back(ret_int);
        }
    }

    sort(intercepts.begin(), intercepts.end());

    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 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 5 ms 468 KB Output is correct
2 Correct 6 ms 468 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 7 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 660 KB Output is correct
2 Correct 20 ms 676 KB Output is correct
3 Correct 15 ms 644 KB Output is correct
4 Correct 8 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 660 KB Output is correct
2 Correct 16 ms 680 KB Output is correct
3 Correct 22 ms 660 KB Output is correct
4 Correct 8 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 664 KB Output is correct
2 Correct 16 ms 800 KB Output is correct
3 Correct 17 ms 644 KB Output is correct
4 Correct 9 ms 692 KB Output is correct
5 Correct 10 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 5552 KB Output is correct
2 Correct 324 ms 5920 KB Output is correct
3 Correct 174 ms 3640 KB Output is correct
4 Correct 137 ms 5932 KB Output is correct
5 Correct 109 ms 3328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 168 ms 5596 KB Output is correct
2 Correct 138 ms 5440 KB Output is correct
3 Correct 148 ms 5948 KB Output is correct
4 Correct 129 ms 6056 KB Output is correct
5 Correct 123 ms 6560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 273 ms 6008 KB Output is correct
2 Correct 347 ms 6132 KB Output is correct
3 Correct 455 ms 6000 KB Output is correct
4 Correct 106 ms 7380 KB Output is correct
5 Correct 175 ms 6108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 348 ms 7076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 205 ms 7052 KB Output is correct
2 Correct 423 ms 6976 KB Output is correct
3 Correct 455 ms 6712 KB Output is correct
4 Correct 103 ms 7436 KB Output is correct
5 Correct 177 ms 6864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 25928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 25892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 37240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 37228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 40444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 40392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 43524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 43496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 49832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 48256 KB Time limit exceeded
2 Halted 0 ms 0 KB -