Submission #949718

# Submission time Handle Problem Language Result Execution time Memory
949718 2024-03-19T15:25:07 Z Kavelmydex Mobile (BOI12_mobile) C++17
0 / 100
175 ms 47696 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);}

int n,l; 
bool in(int x){return 0<=x && x<=l;}
int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> l;
    vector <pi> inp,v;
    For(i,n){
        int x,y; cin >> x >> y;
        y = abs(y);
        inp.pb({x,y});
    }   
    For(i,n){
        int j = i, y = inp[i].s;
        while(j < n && inp[i].f == inp[j].f) y = min(y,inp[j].s), j++;
        v.pb({inp[i].f, y});
        i = j-1;
    }   inp.clear();
    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){
                double cost = OO; pi p;
                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 ), val = sqrt(d * d + y * y);
                    if(val < cost){
                        cost = val;
                        p = {x,y};
                    }
                } q.clear();
                if(in(p.f) || in(v[i].f)) 
                    cmx(ans, cost); 
            }
        }
        q.pb(v[i]);
    }
    cout << fixed << setprecision(4) << ans << endl;
    return 0;
}
# 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 Incorrect 0 ms 460 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 456 KB Output isn't correct
2 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 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 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 39 ms 5152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 4052 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 5588 KB Output is correct
2 Runtime error 22 ms 7668 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 21 ms 8656 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 6344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 24320 KB Output is correct
2 Runtime error 88 ms 21432 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 91 ms 21660 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 97 ms 40200 KB Output is correct
2 Runtime error 106 ms 28760 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 28476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 112 ms 42164 KB Output is correct
2 Runtime error 138 ms 31148 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 129 ms 31340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 123 ms 44476 KB Output is correct
2 Runtime error 142 ms 33284 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 35108 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 157 ms 47696 KB Output is correct
2 Runtime error 175 ms 41152 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 173 ms 41656 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -