Submission #941224

# Submission time Handle Problem Language Result Execution time Memory
941224 2024-03-08T09:57:13 Z Kavelmydex Mobile (BOI12_mobile) C++17
4 / 100
1000 ms 19004 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 double long double
#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);}

double eps = 1e-6;
vector <pi> v;
double n,L;
bool ok(double m){
    double mn = OO, mx = -OO;
    int px = -1;
    For(i,n){
        auto [x,y] = v[i];
        if(y*y > m*m) continue;
        double d = sqrt(m * m - y * y);
        if(mx != -OO && x-d > mx && px != x) return 0;
        if(x-d < mn) mn = x-d;
        if(mx < x+d) mx = x+d;   
        px = x;
    }
    return (mn <= 0 && L <= 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});
    }
    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(20) << 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 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 108 ms 2520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 2520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 78 ms 2516 KB Output is correct
2 Correct 83 ms 2516 KB Output is correct
3 Correct 65 ms 2520 KB Output is correct
4 Incorrect 37 ms 2516 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 2520 KB Output is correct
2 Correct 105 ms 2520 KB Output is correct
3 Correct 73 ms 2520 KB Output is correct
4 Incorrect 38 ms 2516 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 87 ms 2516 KB Output is correct
2 Correct 98 ms 2520 KB Output is correct
3 Correct 74 ms 2520 KB Output is correct
4 Incorrect 44 ms 2516 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 473 ms 10180 KB Output is correct
2 Correct 454 ms 8904 KB Output is correct
3 Correct 462 ms 9416 KB Output is correct
4 Incorrect 187 ms 8896 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 463 ms 9932 KB Output is correct
2 Incorrect 600 ms 10180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 544 ms 17384 KB Output is correct
2 Correct 540 ms 18712 KB Output is correct
3 Correct 537 ms 17588 KB Output is correct
4 Incorrect 234 ms 18876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 580 ms 18192 KB Output is correct
2 Incorrect 938 ms 18116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 619 ms 17588 KB Output is correct
2 Correct 613 ms 17592 KB Output is correct
3 Correct 633 ms 18104 KB Output is correct
4 Incorrect 259 ms 17848 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 624 ms 17844 KB Output is correct
2 Incorrect 972 ms 18360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 710 ms 17856 KB Output is correct
2 Correct 716 ms 17204 KB Output is correct
3 Correct 708 ms 17588 KB Output is correct
4 Incorrect 298 ms 18296 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 719 ms 17944 KB Output is correct
2 Execution timed out 1026 ms 19004 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 930 ms 17592 KB Output is correct
2 Correct 895 ms 17588 KB Output is correct
3 Correct 874 ms 18104 KB Output is correct
4 Correct 386 ms 17332 KB Output is correct
5 Incorrect 469 ms 18592 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 901 ms 17588 KB Output is correct
2 Execution timed out 1072 ms 18108 KB Time limit exceeded
3 Halted 0 ms 0 KB -