Submission #1096173

#TimeUsernameProblemLanguageResultExecution timeMemory
1096173Omar_ElgedawyMobile (BOI12_mobile)C++17
80 / 100
1073 ms50768 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define F first #define S second #define el '\n' #define cout(x) for(auto v:x)cout<<v<<el #define coutp(x) for(auto v:x)cout<<v.F<<' '<<v.S<<el #define cin(x) for(auto &v:x)cin>>v; #define pb(x) push_back(x) #define all(x) x.begin(),x.end() const int N = 5e3 + 5, M = 1e2 + 5, Mod = 1e9 + 7; int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1}; int nxt() { int x; cin >> x; return x; } void solve(int h) { int n; ld m; cin>>n>>m; ld x[n],y[n]; for(int i=0;i<n;i++) { cin>>x[i]>>y[i]; } ld l=1,r=2e9; while(r-l>1e-3) { ld mid=(r+l)/2.0; ld cur=0; for(int i=0;i<n;i++) { ld dist=sqrt(mid*mid-y[i]*y[i]); ld left=x[i]-dist; ld right=x[i]+dist; if(left<=cur)cur=max(cur,right); } if(cur>=m) r=mid; else l=mid; } cout<<fixed<<setprecision(4)<<l; } int32_t main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r" , stdin); // freopen("output.txt", "w", stdout); // freopen("feast.in", "r", stdin); // freopen("feast.out", "w", stdout); // #endif ios_base::sync_with_stdio(false); cin.tie(NULL); int tc = 1; // cin >> tc; for (int i = 1; i <= tc; i++)solve(i); return 0; }
#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...