Submission #1109851

#TimeUsernameProblemLanguageResultExecution timeMemory
1109851vjudge1Mobile (BOI12_mobile)C++17
8 / 100
1063 ms24496 KiB
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int N, L; cin >> N >> L; vector<pair<int, int>> tr(N); for (auto& p : tr) cin >> p.first >> p.second; double low = 0, high = 3 * 1e9; while (low + 1e-5 < high) { double r = (high + low) / 2; vector<pair<double, double>> s; for (auto& p : tr) { if (abs(p.second) >= r) continue; double x = sqrt(r* r - p.second * p.second); double x1 = p.first - x, x2 = p.first + x; // x2 >= s.back().first is always true. That's why we can use merge with stack. while (!s.empty() && s.back().second >= x1) { x1 = min(x1, s.back().first); x2 = max(x2, s.back().second); s.pop_back(); } s.push_back({x1, x2}); } bool ok = false; for (auto& p : s) { if (p.first <= 0 && p.second >= L) { ok = true; } } if (ok) { high = r; } else { low = r; } } cout << high << endl; 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...