Submission #1096174

# Submission time Handle Problem Language Result Execution time Memory
1096174 2024-10-04T03:54:03 Z Omar_Elgedawy Mobile (BOI12_mobile) C++17
75 / 100
1000 ms 46240 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=1.5e9;
    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 504 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
# 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 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 4 ms 600 KB Output is correct
4 Correct 6 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 6 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 600 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 8 ms 472 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 3572 KB Output is correct
2 Correct 41 ms 3932 KB Output is correct
3 Correct 35 ms 2668 KB Output is correct
4 Correct 101 ms 3964 KB Output is correct
5 Correct 41 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 3420 KB Output is correct
2 Correct 71 ms 3452 KB Output is correct
3 Correct 87 ms 4004 KB Output is correct
4 Correct 92 ms 3940 KB Output is correct
5 Correct 105 ms 4628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 3672 KB Output is correct
2 Correct 42 ms 4180 KB Output is correct
3 Correct 55 ms 4048 KB Output is correct
4 Correct 128 ms 5200 KB Output is correct
5 Correct 87 ms 3928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 4944 KB Output is correct
2 Correct 50 ms 4980 KB Output is correct
3 Correct 64 ms 4560 KB Output is correct
4 Correct 142 ms 5204 KB Output is correct
5 Correct 116 ms 4844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 4956 KB Output is correct
2 Correct 48 ms 4988 KB Output is correct
3 Correct 64 ms 4440 KB Output is correct
4 Correct 136 ms 5200 KB Output is correct
5 Correct 117 ms 4728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 249 ms 19536 KB Output is correct
2 Correct 254 ms 22096 KB Output is correct
3 Correct 254 ms 21872 KB Output is correct
4 Correct 666 ms 23684 KB Output is correct
5 Correct 553 ms 21332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 259 ms 22608 KB Output is correct
2 Correct 475 ms 21472 KB Output is correct
3 Correct 336 ms 20564 KB Output is correct
4 Correct 683 ms 23304 KB Output is correct
5 Correct 588 ms 21988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 349 ms 23380 KB Output is correct
2 Correct 320 ms 26504 KB Output is correct
3 Correct 291 ms 25936 KB Output is correct
4 Correct 833 ms 28204 KB Output is correct
5 Correct 705 ms 25684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 324 ms 26708 KB Output is correct
2 Correct 566 ms 25168 KB Output is correct
3 Correct 409 ms 24400 KB Output is correct
4 Correct 798 ms 28448 KB Output is correct
5 Correct 688 ms 26140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 377 ms 27224 KB Output is correct
2 Correct 392 ms 30800 KB Output is correct
3 Correct 370 ms 30288 KB Output is correct
4 Correct 913 ms 33108 KB Output is correct
5 Correct 741 ms 29340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 341 ms 31316 KB Output is correct
2 Correct 616 ms 29776 KB Output is correct
3 Correct 449 ms 29008 KB Output is correct
4 Execution timed out 1006 ms 32732 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 424 ms 31056 KB Output is correct
2 Correct 435 ms 35200 KB Output is correct
3 Correct 502 ms 34700 KB Output is correct
4 Execution timed out 1036 ms 37716 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 388 ms 35664 KB Output is correct
2 Correct 771 ms 33876 KB Output is correct
3 Correct 628 ms 33364 KB Output is correct
4 Execution timed out 1043 ms 37460 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 578 ms 38664 KB Output is correct
2 Correct 549 ms 43604 KB Output is correct
3 Correct 543 ms 43020 KB Output is correct
4 Execution timed out 1070 ms 46240 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 530 ms 44552 KB Output is correct
2 Execution timed out 1004 ms 41864 KB Time limit exceeded
3 Halted 0 ms 0 KB -