Submission #1112827

#TimeUsernameProblemLanguageResultExecution timeMemory
1112827erentor353Mobile (BOI12_mobile)C++17
0 / 100
314 ms32584 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; template<typename T> using oset = __gnu_pbds::tree<T, __gnu_pbds::null_type, greater<T>, __gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; #define vt vector #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() #define ll long long #define ull unsigned ll #define ld long double #define okey order_of_key #define oget find_by_order typedef vt<int> vi; typedef pair<int,int> pi; typedef pair<ll, ll> pll; const ll MAXN = 1e6; const ll MAXM = 50; const ll MAXL = 31; const ll MOD = 1e9 + 7; ll N, L, x[MAXN], y[MAXN]; bool check(double r){ double maximum = 0; for(int i = 0; i<N; ++i){ double diff = r*r-(double)(y[i]*y[i]); if(diff < 0) continue; double sqt = sqrt(diff); double x1 = x[i] - sqt; double x2 = sqt + x[i]; if(x1 > maximum) return false; maximum = max(maximum, x2); } return maximum >= L; } void solve(){ cin>>N>>L; for(int i = 0; i<N; ++i){ cin>>x[i]>>y[i]; } double lo = 0, hi = 1e13; int cnt = 0; while(lo < hi && cnt++ <= MAXM){ double mid = (hi + lo)/2; if(check(mid)){ hi = mid; }else{ lo = mid + 0.001; } } printf("%.4f\n", hi); } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin>>t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...