Submission #941386

# Submission time Handle Problem Language Result Execution time Memory
941386 2024-03-08T16:32:34 Z Kavelmydex Mobile (BOI12_mobile) C++17
65 / 100
686 ms 18920 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;
        bool b1 = ok(m), b2 = ok(m);
        assert(b1 == b2);
        if(b1) 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 1 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 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 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 2 ms 600 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 2 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 2520 KB Output is correct
2 Correct 24 ms 2520 KB Output is correct
3 Correct 18 ms 1500 KB Output is correct
4 Correct 22 ms 2520 KB Output is correct
5 Correct 10 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2520 KB Output is correct
2 Correct 18 ms 2520 KB Output is correct
3 Correct 20 ms 2516 KB Output is correct
4 Correct 22 ms 2520 KB Output is correct
5 Correct 25 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2832 KB Output is correct
2 Correct 26 ms 2648 KB Output is correct
3 Correct 23 ms 2516 KB Output is correct
4 Correct 30 ms 2516 KB Output is correct
5 Correct 21 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 2520 KB Output is correct
2 Correct 29 ms 2516 KB Output is correct
3 Correct 30 ms 2516 KB Output is correct
4 Correct 32 ms 2588 KB Output is correct
5 Correct 25 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 301 ms 9924 KB Output is correct
2 Incorrect 171 ms 9920 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 156 ms 9920 KB Output is correct
2 Correct 411 ms 8896 KB Output is correct
3 Correct 147 ms 9768 KB Output is correct
4 Correct 142 ms 9924 KB Output is correct
5 Correct 123 ms 8644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 18160 KB Output is correct
2 Incorrect 193 ms 17080 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 207 ms 17240 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 408 ms 18920 KB Output is correct
2 Incorrect 257 ms 17076 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 240 ms 18684 KB Output is correct
2 Correct 505 ms 18104 KB Output is correct
3 Correct 211 ms 17592 KB Output is correct
4 Correct 201 ms 17576 KB Output is correct
5 Correct 175 ms 18104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 480 ms 18104 KB Output is correct
2 Incorrect 262 ms 16864 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 18268 KB Output is correct
2 Correct 551 ms 17240 KB Output is correct
3 Correct 236 ms 18720 KB Output is correct
4 Correct 234 ms 18428 KB Output is correct
5 Correct 201 ms 17336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 600 ms 17080 KB Output is correct
2 Incorrect 292 ms 17176 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 324 ms 18112 KB Output is correct
2 Correct 686 ms 17076 KB Output is correct
3 Correct 343 ms 17388 KB Output is correct
4 Correct 298 ms 18044 KB Output is correct
5 Correct 265 ms 17432 KB Output is correct