Submission #906140

#TimeUsernameProblemLanguageResultExecution timeMemory
906140NonozeMobile (BOI12_mobile)C++17
100 / 100
399 ms26812 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; double dist(double x1, pair<double, double> other) { double y1=0; double x2=other.first, y2=other.second; return ((double)sqrt((double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))); } void solve() { cin >> n >> L; a.clear(); for (int i=0; i<n; i++) { int x, y; cin >> x >> y; if (!a.empty() && x==a.back().first) { if (abs(y)<abs(a.back().second)) a.back().second=y; continue; } a.push_back({x, y}); } n=sz(a); double l=0, r=1e9; while (r-l>=0.0001) { 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 && x+dist>borne) borne=x+dist; } if (borne>=L) r=mid; else l=mid; } cout << fixed << setprecision(3) << l << 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...