Submission #715666

#TimeUsernameProblemLanguageResultExecution timeMemory
715666MilosMilutinovicMobile (BOI12_mobile)C++14
70 / 100
1082 ms17724 KiB
#include <bits/stdc++.h> using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, L; std::cin >> n >> L; std::vector<int> x(n), y(n); for (int i = 0; i < n; i++) { std::cin >> x[i] >> y[i]; } const double eps = 1E-4; std::function<bool(double)> check = [&](double r) { double f = 0; for (int i = 0; i < n; i++) { if (r * r >= (long double) y[i] * y[i]) { double p = std::sqrt(r * r - (long double) y[i] * y[i]); if (x[i] - p <= f) { f = std::max(f, x[i] + p); } } } return f >= L; }; double low = 0, high = 2E9, ans = -1; for (int i = 0; i < 200; i++) { double mid = (low + high) / 2; if (check(mid)) { ans = mid; high = mid; } else { low = mid; } } std::cout << std::fixed << std::setprecision(10) << ans << "\n"; return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:17:18: warning: unused variable 'eps' [-Wunused-variable]
   17 |     const double eps = 1E-4;
      |                  ^~~
#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...