Submission #941291

# Submission time Handle Problem Language Result Execution time Memory
941291 2024-03-08T13:07:31 Z Kavelmydex Mobile (BOI12_mobile) C++17
36 / 100
763 ms 35972 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define pb push_back
#define endl "\n"
#define sp ' '
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()

const int N = 3e5+10, OO = 1e18, mod = 1e9+7;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(int &a, int b){a = max(a,b);}
void cmn(int &a, int b){a = min(a,b);}

vector <pi> v;
int n,L;
bool cmp(const pi &a, const pi &b){
    return (a.f==b.f ? abs(a.s) < abs(b.s): a.f < b.f);
}
bool ok(double m){
    double mn = OO, mx = -OO, z = 0;
    For(i,n){
        auto [x,y] = v[i];
        if(y*y > m*m) continue;
        double d = sqrt(m * m - y * y);
        if(x-d <= z){
            z = max(z,x+d);   
        }   
        if(x-d < mn) mn = x-d;
        if(mx < x+d) mx = x+d;   
    }
    return (mn <= 0 && L <= mx && z >= mx);
}
int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> L;
    For(i,n){
        int x,y; cin >> x >> y;
        v.pb({x,y});
    }
    sort(all(v),cmp);
    double l = 0, r = 1e10;
    For(i,100){
        double m = (l+r)/2;
        bool b = ok(m);
        if(b) r = m;
        else l = m;
    }
    cout << setprecision(10) << r << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 1 ms 344 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 1 ms 348 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Incorrect 2 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 3 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 2516 KB Output is correct
2 Correct 41 ms 3540 KB Output is correct
3 Correct 25 ms 2012 KB Output is correct
4 Correct 29 ms 3800 KB Output is correct
5 Correct 18 ms 2012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2516 KB Output is correct
2 Correct 27 ms 3288 KB Output is correct
3 Correct 29 ms 3544 KB Output is correct
4 Correct 29 ms 3544 KB Output is correct
5 Correct 35 ms 3844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 2772 KB Output is correct
2 Correct 54 ms 2520 KB Output is correct
3 Correct 40 ms 2516 KB Output is correct
4 Incorrect 40 ms 2520 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 2520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 53 ms 2516 KB Output is correct
2 Correct 53 ms 2520 KB Output is correct
3 Correct 47 ms 2520 KB Output is correct
4 Incorrect 45 ms 2520 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 266 ms 10448 KB Output is correct
2 Incorrect 319 ms 8900 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 274 ms 8980 KB Output is correct
2 Correct 481 ms 8908 KB Output is correct
3 Correct 226 ms 14008 KB Output is correct
4 Correct 181 ms 17480 KB Output is correct
5 Incorrect 173 ms 15544 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 311 ms 18092 KB Output is correct
2 Incorrect 387 ms 17588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 351 ms 18612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 395 ms 18616 KB Output is correct
2 Incorrect 383 ms 18444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 373 ms 17076 KB Output is correct
2 Correct 575 ms 17080 KB Output is correct
3 Correct 319 ms 23776 KB Output is correct
4 Correct 258 ms 28640 KB Output is correct
5 Incorrect 255 ms 26692 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 432 ms 17592 KB Output is correct
2 Incorrect 422 ms 18792 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 450 ms 18360 KB Output is correct
2 Incorrect 627 ms 17104 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 539 ms 18628 KB Output is correct
2 Incorrect 524 ms 18264 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 549 ms 17596 KB Output is correct
2 Correct 763 ms 18780 KB Output is correct
3 Correct 463 ms 28268 KB Output is correct
4 Correct 395 ms 35972 KB Output is correct
5 Correct 392 ms 30892 KB Output is correct