Submission #967256

#TimeUsernameProblemLanguageResultExecution timeMemory
967256v_mateiMobile (BOI12_mobile)C++17
0 / 100
1054 ms64688 KiB
#include <bits/stdc++.h> #include <cmath> #include <iomanip> #define ll long long #define ull unsigned long long #define pdd std::pair<double, double> #define NMAX 1e6 #define LMAX 1e9 #define INF 3e9 struct Tower { double x, y; }; struct Seg { double st, fn; }; double n, l; std::vector<Tower> s; void citire() { std::cin >> n >> l; s.resize(n); for (int i = 0; i < n; i++) { std::cin >> s[i].x >> s[i].y; } } double b_search(double lo, double hi, std::function<bool(double)> f) { // std::cout << "a\n"; for (int i = 1; i <= 300; i++) { double mid = (lo + hi) / 2; if (f(mid)) hi = mid; else lo = mid; } return lo; } bool find_point(double k) { std::vector<Seg> segs; for (Tower &it : s) { if (k * k < it.y * it.y) return 0; double max_dx = sqrt(k * k - it.y * it.y); segs.push_back({it.x - max_dx, it.x + max_dx}); } Seg curr_inter = {-INF, INF}; for (Seg &it : segs) { if (it.fn < curr_inter.st || it.st > curr_inter.fn) return 0; if (it.st > curr_inter.fn) return 0; if (it.st >= curr_inter.st) { curr_inter.st = it.st; } if (it.fn <= curr_inter.fn) { curr_inter.fn = it.fn; } } return 1; } int main() { citire(); // std::cout << "out\n"; double k = b_search(0, INF, find_point); std::cout << std::setprecision(7) << k; 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...