Submission #1093841

#TimeUsernameProblemLanguageResultExecution timeMemory
1093841damamilaMobile (BOI12_mobile)C++14
100 / 100
624 ms35424 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n; double l; vector<pair<int, int>> points; pair<double, double> circle_intersection(int i, double r) { auto [x, y] = points[i]; if (y > r) return {-1, -1}; //too far away double r2 = r*r; double y2 = y*y; double tmp = sqrt(r2-y2); double x1 = x-tmp; double x2 = x+tmp; return {x1, x2}; } void solve() { double ub = 1.5e9, lb = 1; double m; while (lb+0.001 < ub) { m = (lb+ub)/2; double reach = 0; bool ja = 1; for (int i = 0; i < n; i++) { auto [x1, x2] = circle_intersection(i, m); if (reach < x1) continue; reach = max(reach, x2); } if (reach < l) ja = 0; if (ja) ub = m; else lb = m; } cout << lb << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> l; cout << fixed << setprecision(4); points = vector<pair<int, int>> (n); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; points[i] = {x, y}; } //~ sort(points.begin(), points.end()); solve(); }

Compilation message (stderr)

mobile.cpp: In function 'std::pair<double, double> circle_intersection(long long int, double)':
mobile.cpp:12:7: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   12 |  auto [x, y] = points[i];
      |       ^
mobile.cpp: In function 'void solve()':
mobile.cpp:30:9: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |    auto [x1, x2] = circle_intersection(i, m);
      |         ^
#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...