Submission #1093826

#TimeUsernameProblemLanguageResultExecution timeMemory
1093826damamilaMobile (BOI12_mobile)C++14
0 / 100
251 ms21072 KiB
#include <bits/stdc++.h> using namespace std; //~ #define int long long int n, l; vector<pair<int, int>> points; pair<double, double> circle_intersection(int i, double r) { auto [x, y] = points[i]; double tmp = sqrt(r*r-y*y); double x1 = x-tmp; double x2 = x+tmp; if (x2 < x1) swap(x1, x2); return {x1, x2}; } void solve() { double ub = 10, lb = 0; //change later double m; while (lb+0.0001 < ub) { //~ cout << m << endl; 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+0.0000001 < x1) ja = 0; reach = max(reach, x2); } if (reach+0.0000001 < l) ja = 0; if (ja) { ub = m; } else { lb = m+0.0001; } //~ cout << ja << " " << lb << " " << ub << " " << endl; } cout << ub << 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++) { cin >> points[i].first >> points[i].second; } solve(); }

Compilation message (stderr)

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