Submission #941303

# Submission time Handle Problem Language Result Execution time Memory
941303 2024-03-08T13:22:05 Z Kavelmydex Mobile (BOI12_mobile) C++17
60 / 100
1000 ms 24240 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#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 = -2e9, mx = 2e9, 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 >= L);
}
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 = 1e12;
    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 0 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 392 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 664 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 6 ms 676 KB Output is correct
3 Correct 5 ms 876 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 2528 KB Output is correct
2 Correct 83 ms 2516 KB Output is correct
3 Correct 43 ms 1500 KB Output is correct
4 Correct 37 ms 2516 KB Output is correct
5 Correct 27 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 2520 KB Output is correct
2 Correct 37 ms 2520 KB Output is correct
3 Correct 41 ms 2520 KB Output is correct
4 Correct 43 ms 2520 KB Output is correct
5 Correct 47 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 2520 KB Output is correct
2 Correct 83 ms 2816 KB Output is correct
3 Correct 66 ms 2520 KB Output is correct
4 Correct 46 ms 2520 KB Output is correct
5 Correct 46 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 2520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 106 ms 2576 KB Output is correct
2 Correct 99 ms 2520 KB Output is correct
3 Correct 77 ms 2516 KB Output is correct
4 Correct 49 ms 2520 KB Output is correct
5 Correct 58 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 481 ms 9152 KB Output is correct
2 Incorrect 480 ms 8884 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 491 ms 9404 KB Output is correct
2 Correct 610 ms 10180 KB Output is correct
3 Correct 402 ms 9680 KB Output is correct
4 Correct 227 ms 9668 KB Output is correct
5 Correct 237 ms 10384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 576 ms 18356 KB Output is correct
2 Incorrect 575 ms 17340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 578 ms 18608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 672 ms 18352 KB Output is correct
2 Incorrect 649 ms 18236 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 656 ms 18616 KB Output is correct
2 Correct 753 ms 17596 KB Output is correct
3 Correct 569 ms 17848 KB Output is correct
4 Correct 322 ms 17588 KB Output is correct
5 Correct 337 ms 18360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 770 ms 18600 KB Output is correct
2 Incorrect 757 ms 18356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 777 ms 18360 KB Output is correct
2 Correct 822 ms 18364 KB Output is correct
3 Correct 648 ms 17080 KB Output is correct
4 Correct 364 ms 18616 KB Output is correct
5 Correct 411 ms 18800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 956 ms 18616 KB Output is correct
2 Incorrect 955 ms 24240 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 927 ms 17420 KB Output is correct
2 Execution timed out 1006 ms 17076 KB Time limit exceeded
3 Halted 0 ms 0 KB -