Submission #941331

# Submission time Handle Problem Language Result Execution time Memory
941331 2024-03-08T14:36:44 Z Kavelmydex Mobile (BOI12_mobile) C++17
36 / 100
456 ms 18924 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 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 >= 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,60){
        double m = (l+r)/2;
        if(ok(m)) r = m;
        else l = m;
    }
    cout << setprecision(10) << r << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 504 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 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
# 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 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2520 KB Output is correct
2 Correct 26 ms 2412 KB Output is correct
3 Correct 16 ms 1500 KB Output is correct
4 Correct 22 ms 2572 KB Output is correct
5 Correct 12 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2520 KB Output is correct
2 Correct 22 ms 2520 KB Output is correct
3 Correct 21 ms 2520 KB Output is correct
4 Correct 22 ms 2644 KB Output is correct
5 Correct 23 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2520 KB Output is correct
2 Correct 32 ms 2564 KB Output is correct
3 Correct 32 ms 2520 KB Output is correct
4 Incorrect 27 ms 2504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 2412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 2520 KB Output is correct
2 Correct 34 ms 2520 KB Output is correct
3 Correct 30 ms 2608 KB Output is correct
4 Incorrect 28 ms 2520 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 175 ms 9184 KB Output is correct
2 Incorrect 174 ms 8892 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 184 ms 9316 KB Output is correct
2 Correct 269 ms 9668 KB Output is correct
3 Correct 152 ms 9156 KB Output is correct
4 Correct 128 ms 10704 KB Output is correct
5 Incorrect 128 ms 8640 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 201 ms 17800 KB Output is correct
2 Incorrect 202 ms 17848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 210 ms 18352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 245 ms 18360 KB Output is correct
2 Incorrect 234 ms 17592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 246 ms 18872 KB Output is correct
2 Correct 328 ms 18028 KB Output is correct
3 Correct 208 ms 18484 KB Output is correct
4 Correct 188 ms 17844 KB Output is correct
5 Incorrect 174 ms 18228 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 255 ms 18368 KB Output is correct
2 Incorrect 278 ms 18924 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 286 ms 18364 KB Output is correct
2 Incorrect 365 ms 17916 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 327 ms 18056 KB Output is correct
2 Incorrect 380 ms 17844 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 343 ms 18072 KB Output is correct
2 Correct 456 ms 18912 KB Output is correct
3 Correct 292 ms 17844 KB Output is correct
4 Correct 285 ms 18360 KB Output is correct
5 Correct 266 ms 18360 KB Output is correct