Submission #720552

# Submission time Handle Problem Language Result Execution time Memory
720552 2023-04-08T13:12:14 Z hail Mobile (BOI12_mobile) C++17
100 / 100
706 ms 35400 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define int long long 
#define pi pair<int, int>
#define mp make_pair
#define ld long double
#define fi first
#define se second
#define db double
 
const int MODa = 7 + (int)1e9;
const int INF = (int)4e18;
const int MOD = 998244353;

int n, l;
const int MXN = 1000005;
int x[MXN]{};
int y[MXN]{};

bool check(db r)
{
    db mx = 0;
    db rr = r*r;
    //cerr<<"r = "<<r<<"\n";
    for(int i=1; i<=n; i++)
    {
        if(r<y[i]) continue;
        db sqv = sqrtl(rr - y[i]*y[i]);
        if(x[i]-sqv>mx) continue;
        mx = max(mx, x[i]+sqv);
        //cerr<<i<<" "<<mx<<"\n";
        if(mx>=l) return true;
    }
    return false;
}

void solve()
{
    cin>>n>>l;
    for(int i=1; i<=n; i++)
    {
        cin>>x[i]>>y[i];
    }

    db high = 6e9;
    db low = 0;
    while(high-low>0.001)
    {
        db mid = (high+low)/2;
        if(check(mid)) high = mid;
        else low = mid;
    }
    cout<<setprecision(30);
    cout<<low<<"\n";
}
 
signed main()
{
    fast_io;
    
    int t=1; 
    //cin>>t;
    while(t--)
    {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 324 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 324 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 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 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 5 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 4 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 392 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2256 KB Output is correct
2 Correct 21 ms 2520 KB Output is correct
3 Correct 22 ms 1736 KB Output is correct
4 Correct 44 ms 2640 KB Output is correct
5 Correct 20 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 2260 KB Output is correct
2 Correct 34 ms 2224 KB Output is correct
3 Correct 57 ms 2612 KB Output is correct
4 Correct 47 ms 2768 KB Output is correct
5 Correct 70 ms 3152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2252 KB Output is correct
2 Correct 30 ms 2772 KB Output is correct
3 Correct 25 ms 2504 KB Output is correct
4 Correct 85 ms 3704 KB Output is correct
5 Correct 45 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 3404 KB Output is correct
2 Correct 39 ms 3264 KB Output is correct
3 Correct 35 ms 2800 KB Output is correct
4 Correct 94 ms 3836 KB Output is correct
5 Correct 52 ms 3140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 3400 KB Output is correct
2 Correct 38 ms 3280 KB Output is correct
3 Correct 26 ms 2868 KB Output is correct
4 Correct 72 ms 3808 KB Output is correct
5 Correct 59 ms 3148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 187 ms 12392 KB Output is correct
2 Correct 171 ms 15864 KB Output is correct
3 Correct 135 ms 15376 KB Output is correct
4 Correct 356 ms 17720 KB Output is correct
5 Correct 280 ms 14972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 163 ms 16476 KB Output is correct
2 Correct 210 ms 14764 KB Output is correct
3 Correct 125 ms 13888 KB Output is correct
4 Correct 363 ms 17452 KB Output is correct
5 Correct 290 ms 15432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 200 ms 14860 KB Output is correct
2 Correct 225 ms 19076 KB Output is correct
3 Correct 159 ms 18420 KB Output is correct
4 Correct 480 ms 21616 KB Output is correct
5 Correct 332 ms 17624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 19472 KB Output is correct
2 Correct 275 ms 17648 KB Output is correct
3 Correct 164 ms 16460 KB Output is correct
4 Correct 423 ms 21464 KB Output is correct
5 Correct 348 ms 18476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 247 ms 17408 KB Output is correct
2 Correct 197 ms 22136 KB Output is correct
3 Correct 188 ms 21452 KB Output is correct
4 Correct 531 ms 24828 KB Output is correct
5 Correct 351 ms 20316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 22868 KB Output is correct
2 Correct 269 ms 20536 KB Output is correct
3 Correct 175 ms 19612 KB Output is correct
4 Correct 483 ms 24672 KB Output is correct
5 Correct 395 ms 21424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 411 ms 19660 KB Output is correct
2 Correct 241 ms 25380 KB Output is correct
3 Correct 229 ms 24568 KB Output is correct
4 Correct 588 ms 28564 KB Output is correct
5 Correct 420 ms 24008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 243 ms 26024 KB Output is correct
2 Correct 311 ms 23392 KB Output is correct
3 Correct 184 ms 22372 KB Output is correct
4 Correct 550 ms 28324 KB Output is correct
5 Correct 463 ms 24440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 24656 KB Output is correct
2 Correct 265 ms 31516 KB Output is correct
3 Correct 295 ms 30524 KB Output is correct
4 Correct 659 ms 35152 KB Output is correct
5 Correct 506 ms 29568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 323 ms 32500 KB Output is correct
2 Correct 344 ms 29256 KB Output is correct
3 Correct 237 ms 28268 KB Output is correct
4 Correct 706 ms 35400 KB Output is correct
5 Correct 547 ms 30716 KB Output is correct