Submission #1091430

#TimeUsernameProblemLanguageResultExecution timeMemory
1091430speedcodeBalloons (CEOI11_bal)C++17
100 / 100
378 ms5460 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); int n; cin >> n; stack<pair<double, pair<double, double>>> hi; // position, radius while (n--) { double x, r; cin >> x >> r; double radius = r; while (hi.size() && x > hi.top().first) { hi.pop(); } if (!hi.size()) { hi.push({1000000002, {radius, x}}); cout << fixed << setprecision(3) << radius << '\n'; } else { auto u = hi.top(); radius = min(r, pow(x - u.second.second, 2) / 4.0 / u.second.first); cout << fixed << setprecision(3) << radius << '\n'; while (hi.size()) { if (radius >= hi.top().second.first) { hi.pop(); continue; } double d = sqrt(radius / hi.top().second.first); double g = (x - d * hi.top().second.second) / (1 - d); if (g >= hi.top().first) { hi.pop(); } else break; } if (hi.size()) { double d = sqrt(radius / hi.top().second.first); double g = (x - d * hi.top().second.second) / (1 - d); hi.push({g, {radius, x}}); } else { hi.push({1000000002, {radius, x}}); } } cout << ""; } }
#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...