Submission #941308

# Submission time Handle Problem Language Result Execution time Memory
941308 2024-03-08T13:25:48 Z Kavelmydex Mobile (BOI12_mobile) C++17
65 / 100
968 ms 26304 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 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});
    }
    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 0 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 2 ms 568 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 5 ms 668 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 3 ms 604 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 4 ms 664 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 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 600 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 2520 KB Output is correct
2 Correct 68 ms 2520 KB Output is correct
3 Correct 39 ms 1500 KB Output is correct
4 Correct 31 ms 2520 KB Output is correct
5 Correct 22 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2520 KB Output is correct
2 Correct 31 ms 2520 KB Output is correct
3 Correct 35 ms 2520 KB Output is correct
4 Correct 32 ms 2520 KB Output is correct
5 Correct 35 ms 2580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2520 KB Output is correct
2 Correct 73 ms 2520 KB Output is correct
3 Correct 61 ms 2776 KB Output is correct
4 Correct 37 ms 2516 KB Output is correct
5 Correct 38 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 93 ms 2520 KB Output is correct
2 Correct 88 ms 2520 KB Output is correct
3 Correct 71 ms 2520 KB Output is correct
4 Correct 41 ms 2520 KB Output is correct
5 Correct 42 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 457 ms 8912 KB Output is correct
2 Incorrect 442 ms 9148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 479 ms 10180 KB Output is correct
2 Correct 591 ms 9644 KB Output is correct
3 Correct 361 ms 9892 KB Output is correct
4 Correct 176 ms 8896 KB Output is correct
5 Correct 189 ms 9420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 568 ms 17592 KB Output is correct
2 Incorrect 533 ms 17332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 541 ms 17848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 647 ms 18776 KB Output is correct
2 Incorrect 611 ms 17852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 638 ms 17588 KB Output is correct
2 Correct 701 ms 18964 KB Output is correct
3 Correct 521 ms 18872 KB Output is correct
4 Correct 307 ms 17548 KB Output is correct
5 Correct 273 ms 18052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 725 ms 17592 KB Output is correct
2 Incorrect 729 ms 17848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 729 ms 18620 KB Output is correct
2 Correct 772 ms 17688 KB Output is correct
3 Correct 580 ms 17592 KB Output is correct
4 Correct 286 ms 19116 KB Output is correct
5 Correct 304 ms 18572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 892 ms 18872 KB Output is correct
2 Incorrect 903 ms 17588 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 881 ms 17128 KB Output is correct
2 Correct 968 ms 17316 KB Output is correct
3 Correct 723 ms 22956 KB Output is correct
4 Correct 372 ms 26304 KB Output is correct
5 Correct 420 ms 23956 KB Output is correct