Submission #655454

# Submission time Handle Problem Language Result Execution time Memory
655454 2022-11-04T13:07:25 Z bLIC Mobile (BOI12_mobile) C++17
4 / 100
1000 ms 81008 KB
#include <bits/stdc++.h>
using namespace std;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define pb push_back
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef vector<vi> vvi;

#define dbg if(1)

template <class _T>
string printbit(_T x) {string s="";while(x){s=((x%2)?'1':'0')+s;x/=2;} return s;}
template <class _T>
string printbit(_T x, int len) {string s="";while(len--){s=((x%2)?'1':'0')+s;x/=2;} return s;}

const int MOD = 1e9+7;
const int INF = 1e9;
const int maxN = 1e6+5;


ll n;
long double l;
vector<pair<long double, long double>> cor(maxN);


bool check(long double mid){
     vector<pair<long double, long double>> coord;
     for (int i =0;i<n;i++){
          auto p = cor[i];
          auto power = mid;
          if (p.second-power>0) continue;
          else {
               long double len = sqrt(power*power - p.sd*p.sd);
               coord.pb(make_pair(p.ft-len, p.ft+len));
          }
     }
     sort(all(coord));
     if (coord.empty() || coord[0].ft>1e-5) return false;

     long double curr = 0;
     for (auto x:coord){
          if (x.ft-curr>-1e-4) return false;
          curr = max(curr, x.sd);
          if (curr-l>-1e-4) return true;
     }
     return curr-l>-1e-4;
}

void solve(){
     cin>>n>>l;
     for (int i = 0;i<n;i++) cin>>cor[i].ft>>cor[i].sd;
     long double l = 0, r = 1e14;
     while(r-l>1e-5){
          long double mid = (l+r)/2;
          if (check(mid)) r = mid;
          else l = mid;
     }
     cout<<fixed<<setprecision(6)<<r;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
//     cin>>t;

    while(t--){

        solve();
        cout<<endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 31572 KB Output is correct
2 Correct 25 ms 31552 KB Output is correct
3 Correct 25 ms 31620 KB Output is correct
4 Correct 25 ms 31572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 31584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 31868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 32048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 32056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 32052 KB Output is correct
2 Correct 52 ms 32056 KB Output is correct
3 Correct 61 ms 32044 KB Output is correct
4 Incorrect 62 ms 32116 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 378 ms 38144 KB Output is correct
2 Correct 691 ms 38336 KB Output is correct
3 Correct 436 ms 35424 KB Output is correct
4 Incorrect 652 ms 38168 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 699 ms 38264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 638 ms 38588 KB Output is correct
2 Correct 736 ms 38404 KB Output is correct
3 Correct 922 ms 38444 KB Output is correct
4 Execution timed out 1085 ms 38888 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 753 ms 39280 KB Output is correct
2 Correct 902 ms 39060 KB Output is correct
3 Execution timed out 1068 ms 38928 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 713 ms 38960 KB Output is correct
2 Correct 903 ms 39192 KB Output is correct
3 Execution timed out 1072 ms 38904 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 63764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 63860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 80944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 80920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 80932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 80960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 80972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 81008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 80868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 80868 KB Time limit exceeded
2 Halted 0 ms 0 KB -