Submission #655452

# Submission time Handle Problem Language Result Execution time Memory
655452 2022-11-04T12:59:13 Z bLIC Mobile (BOI12_mobile) C++17
4 / 100
1000 ms 81072 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) 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>0) return false;

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

void solve(){
     // cout<<sizeof(l);
     // return;
     cin>>n>>l;
     for (int i = 0;i<n;i++) cin>>cor[i].ft>>cor[i].sd;
     long double l = 0, r = 1e10;
     while(r-l>1e-4){
          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 25 ms 31572 KB Output is correct
2 Correct 25 ms 31700 KB Output is correct
3 Correct 24 ms 31640 KB Output is correct
4 Correct 26 ms 31536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 31636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 31848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 32056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 32048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 32060 KB Output is correct
2 Correct 52 ms 32228 KB Output is correct
3 Correct 52 ms 32044 KB Output is correct
4 Incorrect 53 ms 32068 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 270 ms 38144 KB Output is correct
2 Correct 513 ms 39260 KB Output is correct
3 Correct 331 ms 36012 KB Output is correct
4 Incorrect 515 ms 39292 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 552 ms 38228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 476 ms 38652 KB Output is correct
2 Correct 582 ms 38368 KB Output is correct
3 Correct 712 ms 38440 KB Output is correct
4 Incorrect 738 ms 38876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 632 ms 39156 KB Output is correct
2 Correct 719 ms 39036 KB Output is correct
3 Correct 906 ms 38940 KB Output is correct
4 Incorrect 639 ms 38868 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 527 ms 38932 KB Output is correct
2 Correct 738 ms 38912 KB Output is correct
3 Correct 856 ms 38900 KB Output is correct
4 Incorrect 802 ms 38888 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 63940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 63780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 81044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 81072 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 1096 ms 80888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 80888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 80876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 80892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 80904 KB Time limit exceeded
2 Halted 0 ms 0 KB -