Submission #371516

# Submission time Handle Problem Language Result Execution time Memory
371516 2021-02-26T19:49:22 Z Codurr Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 31852 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n,l;
    cin>>n>>l;
    vector<pair<double,double>> v(n);
    for(int i=0;i<n;i++) cin>>v[i].first>>v[i].second;
    for(int i=1;i<n;i++){
        if(v[i-1].first==v[i].first){
            int x=i-1;
            v.erase(v.begin()+i);
            i=x;
        }
    }
    double l1=0,r=1e9*sqrt(2);
    for(int j=1;j<100;j++){
        double m=(l1+r)/2;
        bool ans=true;
        vector<pair<double,double>> c(n);
        for(int i=0;i<n;i++){
            c[i].first=v[i].first-sqrt(m*m-v[i].second*v[i].second);
            c[i].second=v[i].first+sqrt(m*m-v[i].second*v[i].second);
        }
        if(c[0].first>0) ans=false;
        else if(c[n-1].second<l) ans=false;
        else{
            for(int i=0;i<n-1;i++){
                if(c[i+1].first>c[i].second) {ans=false; break;}
            }
        }
        if(ans) r=m;
        else l1=m;
    }
    cout<<fixed<<setprecision(4)<<r;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 1516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 1516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 89 ms 3084 KB Output is correct
2 Execution timed out 1090 ms 2796 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 1900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 1900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 533 ms 16032 KB Output is correct
2 Execution timed out 1092 ms 15852 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 8204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 688 ms 19204 KB Output is correct
2 Execution timed out 1084 ms 19128 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 9708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 804 ms 22320 KB Output is correct
2 Execution timed out 1089 ms 22252 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 11244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 880 ms 25492 KB Output is correct
2 Execution timed out 1084 ms 25324 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 13056 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 31852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 15980 KB Time limit exceeded
2 Halted 0 ms 0 KB -