Submission #941390

# Submission time Handle Problem Language Result Execution time Memory
941390 2024-03-08T16:44:06 Z Kavelmydex Mobile (BOI12_mobile) C++17
65 / 100
399 ms 19136 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 <= x+d){
            z = x+d;
        }   
        if(x-d < mn) mn = x-d;
        if(mx < x+d) mx = x+d;    
        if(mn <= 0 && L <= mx && z >= L) return 1;
    }
    return 0;
}
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;
    }
    assert(r <= 2236067977);
    cout << setprecision(10) << r << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 344 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 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 2 ms 608 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 2520 KB Output is correct
2 Correct 17 ms 2520 KB Output is correct
3 Correct 11 ms 1500 KB Output is correct
4 Correct 17 ms 2520 KB Output is correct
5 Correct 8 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 2520 KB Output is correct
2 Correct 14 ms 2728 KB Output is correct
3 Correct 16 ms 2520 KB Output is correct
4 Correct 22 ms 2600 KB Output is correct
5 Correct 19 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2520 KB Output is correct
2 Correct 19 ms 2772 KB Output is correct
3 Correct 18 ms 2520 KB Output is correct
4 Correct 24 ms 2608 KB Output is correct
5 Correct 17 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 2520 KB Output is correct
2 Correct 25 ms 2516 KB Output is correct
3 Correct 21 ms 2520 KB Output is correct
4 Correct 25 ms 2520 KB Output is correct
5 Correct 20 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 204 ms 9160 KB Output is correct
2 Incorrect 120 ms 9668 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 114 ms 8796 KB Output is correct
2 Correct 237 ms 9156 KB Output is correct
3 Correct 113 ms 10172 KB Output is correct
4 Correct 110 ms 10428 KB Output is correct
5 Correct 111 ms 10432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 225 ms 18236 KB Output is correct
2 Incorrect 138 ms 17084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 17332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 275 ms 19136 KB Output is correct
2 Incorrect 160 ms 18688 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 165 ms 17856 KB Output is correct
2 Correct 303 ms 17936 KB Output is correct
3 Correct 149 ms 17568 KB Output is correct
4 Correct 161 ms 18872 KB Output is correct
5 Correct 138 ms 17544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 18096 KB Output is correct
2 Incorrect 189 ms 17848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 188 ms 18100 KB Output is correct
2 Correct 340 ms 18104 KB Output is correct
3 Correct 166 ms 18624 KB Output is correct
4 Correct 180 ms 18360 KB Output is correct
5 Correct 153 ms 18020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 362 ms 17388 KB Output is correct
2 Incorrect 218 ms 18424 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 266 ms 18876 KB Output is correct
2 Correct 399 ms 18516 KB Output is correct
3 Correct 214 ms 17336 KB Output is correct
4 Correct 239 ms 18312 KB Output is correct
5 Correct 202 ms 17592 KB Output is correct