Submission #949666

# Submission time Handle Problem Language Result Execution time Memory
949666 2024-03-19T15:01:18 Z Kavelmydex Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 33988 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 endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
 
const int N = 4e5+10, OO = 1e18, mod = 1e9, mx = 2e6;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(double &a, double b){a = max(a,b);}
void cmn(double &a, double b){a = min(a,b);}

int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n,l; cin >> n >> l;
    vector <pi> v;
    For(i,n){
        int x,y; cin >> x >> y;
        y = abs(y);
        v.pb({x,y});
    }   
    double ans = 0, mn = OO, mn2 = OO;
    For(i,n){
        cmn(mn, sqrt(v[i].f*v[i].f + v[i].s*v[i].s));
        int x = abs(v[i].f-l);
        cmn(mn2, sqrt(x * x + v[i].s * v[i].s));
    }
    cmx(ans, max(mn2,mn));
    vector <pi> u,q;
    For(i,n){
        bool ok = 0;
        for(auto [x,y]: u){
            int X = abs(x-v[i].f);
            if(X * X + y * y <= v[i].s * v[i].s){
                ok = 1;
            }
        }
        if(ok){
            u.pb(v[i]);
        } else {
            u.clear();
            u.pb(v[i]);
            if(!i || v[i].f < 0);
            else {
                double cost = OO;
                for(auto [x,y]: q){
                    double X = abs(x-v[i].f);
                    double d = ( X*X + v[i].s * v[i].s - y * y ) / ( 2*X );
                    cmn(cost, sqrt(d * d + y * y));
                } q.clear();
                cmx(ans, cost); 
            }
        }
        q.pb(v[i]);
    }
    cout << fixed << setprecision(4) << ans << 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 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 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 1 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 3284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 3288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 3288 KB Output is correct
2 Incorrect 22 ms 3800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 3800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 5068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 62 ms 12476 KB Output is correct
2 Correct 810 ms 16820 KB Output is correct
3 Execution timed out 1022 ms 18080 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 16672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 86 ms 21856 KB Output is correct
2 Execution timed out 1034 ms 27044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 26060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 21940 KB Output is correct
2 Execution timed out 1022 ms 25268 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 25780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 97 ms 23016 KB Output is correct
2 Execution timed out 1039 ms 26876 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 28268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 119 ms 25260 KB Output is correct
2 Execution timed out 1086 ms 33472 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 33988 KB Time limit exceeded
2 Halted 0 ms 0 KB -