Submission #906111

#TimeUsernameProblemLanguageResultExecution timeMemory
906111NonozeMobile (BOI12_mobile)C++17
0 / 100
496 ms16220 KiB
#include <bits/stdc++.h> #define int long long #define sz(x) (int)(x.size()) using namespace std; int n, L; vector<pair<double, double>> a; long double dist(long double x1, pair<long double, long double> other) { long double y1=0; long double x2=other.first, y2=other.second; return ((long double)sqrt((long double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))); } void solve() { cin >> n >> L; a.clear(); a.resize(n); for (auto &u: a) cin >> u.first >> u.second; double ans=0; double l=0, r=1e9; while (r-l>=0.00001) { double mid=(l+r)/2; double borne=0; for (int i=0; i<n; i++) { double x=a[i].first, y=a[i].second; double dist=sqrt((double)(mid*mid-y*y)); if (x-dist<=borne) borne+=x+dist; } if (borne>=L) { ans=mid; r=mid-0.00001; } else l=mid+0.00001; } cout << fixed << setprecision(4) << ans << endl; return; } signed main() { ios::sync_with_stdio(0); cin.tie(0); solve(); 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...