Submission #286487

#TimeUsernameProblemLanguageResultExecution timeMemory
286487__SIGSEGV__Mobile (BOI12_mobile)C++17
0 / 100
1094 ms33380 KiB
/** * AUTHOR: __SIGSEGV__ * CREATED: 30.08.2020 02:54:38 **/ #include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double inf = 1e18; int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int n; double l; cin >> n >> l; vector<pair<int, int>> points(n); for (int i = 0; i < n; i++) { cin >> points[i].first >> points[i].second; points[i].second = abs(points[i].second); } sort(points.begin(), points.end()); vector<pair<double, double>> poi; int last; for (int i = 0; i < n; i++) { poi.emplace_back((double) points[i].first, (double) points[i].second); last = points[i].first; i++; while (i < n && points[i].first == last) ++i; --i; } auto f = [&](double x) { double ret = inf; for (int i = 0; i < n; i++) { double d = sqrt(poi[i].second * poi[i].second + abs(x - poi[i].first) * abs(x - poi[i].first)); ret = min(ret, d); } return ret; }; double left = 0, right = l; while (abs(right - left) > eps) { double x1 = left + (right - left) / 3.0; double x2 = right - (right - left) / 3.0; double f1 = f(x1), f2 = f(x2); cerr << x1 << " " << x2 << '\n'; if (f1 < f2) left = x1; else right = x2; } double ans = f(left); cout.precision(6); cout << fixed; cout << ans << '\n'; 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...