Submission #655450

# Submission time Handle Problem Language Result Execution time Memory
655450 2022-11-04T12:47:13 Z bLIC Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 48176 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, l;
vll cor(maxN);


bool check(double mid){
     vector<pair<double, double>> coord;
     for (int i =0;i<n;i++){
          auto p = cor[i];
          auto power = mid;
          if (p.second>power) continue;
          else {
               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;

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

void solve(){
     cin>>n>>l;
     for (int i = 0;i<n;i++) cin>>cor[i].ft>>cor[i].sd;
     double l = 0, r = 1e10;
     while(r-l>1e-4){
          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 Incorrect 7 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 16084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 16180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 16196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 16196 KB Output is correct
2 Correct 16 ms 16368 KB Output is correct
3 Correct 19 ms 16196 KB Output is correct
4 Incorrect 19 ms 16188 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 183 ms 19260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 238 ms 19284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 182 ms 19468 KB Output is correct
2 Correct 288 ms 19368 KB Output is correct
3 Correct 320 ms 19392 KB Output is correct
4 Incorrect 303 ms 19572 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 265 ms 19632 KB Output is correct
2 Correct 341 ms 19628 KB Output is correct
3 Correct 402 ms 19620 KB Output is correct
4 Incorrect 270 ms 19600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 216 ms 19652 KB Output is correct
2 Correct 361 ms 19732 KB Output is correct
3 Correct 404 ms 19652 KB Output is correct
4 Incorrect 193 ms 19596 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 32092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 32036 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 42020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 41840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 43420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 43384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 45072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 45048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 48176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 48160 KB Time limit exceeded
2 Halted 0 ms 0 KB -