Submission #1096173

# Submission time Handle Problem Language Result Execution time Memory
1096173 2024-10-04T03:53:04 Z Omar_Elgedawy Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 50768 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define ld long double
#define F first
#define S second
#define el '\n'
#define cout(x) for(auto v:x)cout<<v<<el
#define coutp(x) for(auto v:x)cout<<v.F<<' '<<v.S<<el
#define cin(x) for(auto &v:x)cin>>v;
#define pb(x) push_back(x)
#define all(x)  x.begin(),x.end()

const int N = 5e3 + 5, M = 1e2 + 5, Mod = 1e9 + 7;
int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1};

int nxt()
{
    int x;
    cin >> x;
    return x;
}
void solve(int h)
{
    int n;
    ld m;
    cin>>n>>m;
    ld x[n],y[n];
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
    }
    ld l=1,r=2e9;
    while(r-l>1e-3)
    {
        ld mid=(r+l)/2.0;
        ld cur=0;
        for(int i=0;i<n;i++)
        {
            ld dist=sqrt(mid*mid-y[i]*y[i]);
            ld left=x[i]-dist;
            ld right=x[i]+dist;
            if(left<=cur)cur=max(cur,right);
        }
        if(cur>=m)
            r=mid;
        else
            l=mid;
    }
    cout<<fixed<<setprecision(4)<<l;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r" , stdin);
    // freopen("output.txt", "w", stdout);
    // freopen("feast.in", "r", stdin);
    // freopen("feast.out", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tc = 1;
    // cin >> tc;
    for (int i = 1; i <= tc; i++)solve(i);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 8 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 660 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 3420 KB Output is correct
2 Correct 40 ms 3928 KB Output is correct
3 Correct 34 ms 2652 KB Output is correct
4 Correct 91 ms 3932 KB Output is correct
5 Correct 42 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 3420 KB Output is correct
2 Correct 77 ms 3412 KB Output is correct
3 Correct 96 ms 4016 KB Output is correct
4 Correct 91 ms 3940 KB Output is correct
5 Correct 113 ms 4432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 3868 KB Output is correct
2 Correct 46 ms 3928 KB Output is correct
3 Correct 56 ms 3932 KB Output is correct
4 Correct 140 ms 5456 KB Output is correct
5 Correct 85 ms 3932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 4948 KB Output is correct
2 Correct 52 ms 4856 KB Output is correct
3 Correct 59 ms 4608 KB Output is correct
4 Correct 129 ms 5372 KB Output is correct
5 Correct 104 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 4864 KB Output is correct
2 Correct 51 ms 4988 KB Output is correct
3 Correct 64 ms 4604 KB Output is correct
4 Correct 130 ms 5500 KB Output is correct
5 Correct 105 ms 4688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 266 ms 20304 KB Output is correct
2 Correct 260 ms 23632 KB Output is correct
3 Correct 265 ms 23124 KB Output is correct
4 Correct 660 ms 25440 KB Output is correct
5 Correct 569 ms 23120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 261 ms 24144 KB Output is correct
2 Correct 500 ms 22612 KB Output is correct
3 Correct 329 ms 21840 KB Output is correct
4 Correct 684 ms 25296 KB Output is correct
5 Correct 583 ms 23400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 310 ms 24332 KB Output is correct
2 Correct 322 ms 28500 KB Output is correct
3 Correct 330 ms 27728 KB Output is correct
4 Correct 850 ms 31060 KB Output is correct
5 Correct 724 ms 27220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 299 ms 29008 KB Output is correct
2 Correct 607 ms 26924 KB Output is correct
3 Correct 393 ms 26012 KB Output is correct
4 Correct 856 ms 30800 KB Output is correct
5 Correct 674 ms 27792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 340 ms 28404 KB Output is correct
2 Correct 328 ms 33028 KB Output is correct
3 Correct 351 ms 32328 KB Output is correct
4 Correct 884 ms 35900 KB Output is correct
5 Correct 732 ms 31448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 380 ms 33728 KB Output is correct
2 Correct 712 ms 31564 KB Output is correct
3 Correct 461 ms 30664 KB Output is correct
4 Correct 942 ms 35740 KB Output is correct
5 Correct 827 ms 32336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 502 ms 32416 KB Output is correct
2 Correct 509 ms 37712 KB Output is correct
3 Correct 493 ms 37096 KB Output is correct
4 Execution timed out 1073 ms 41044 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 517 ms 38484 KB Output is correct
2 Correct 798 ms 35924 KB Output is correct
3 Correct 554 ms 34896 KB Output is correct
4 Execution timed out 1049 ms 40788 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 522 ms 40436 KB Output is correct
2 Correct 580 ms 47440 KB Output is correct
3 Correct 544 ms 46212 KB Output is correct
4 Execution timed out 1045 ms 50768 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 524 ms 48212 KB Output is correct
2 Execution timed out 1060 ms 44936 KB Time limit exceeded
3 Halted 0 ms 0 KB -