Submission #651924

#TimeUsernameProblemLanguageResultExecution timeMemory
651924womogenesBalloons (CEOI11_bal)C++14
100 / 100
359 ms10128 KiB
// https://oj.uz/problem/view/CEOI11_bal // Balloons #include <bits/stdc++.h> #define x first #define r second using namespace std; int main() { int n; cin >> n; vector<pair<double, double>> balls(n); for (int i = 0; i < n; i++) { cin >> balls[i].x >> balls[i].r; } // Stack algorithm stack<pair<int, double>> st; vector<double> radii(n); for (int i = 0; i < n; i++) { double max_rad = balls[i].r; while (!st.empty()) { pair<int, double> top = st.top(); max_rad = min(pow(balls[i].x - top.x, 2) / (4 * top.r), max_rad); if (max_rad >= top.r) { st.pop(); } else { break; } } st.push(make_pair(balls[i].x, max_rad)); radii[i] = max_rad; } cout << fixed << setprecision(3); for (double r : radii) { cout << r << "\n"; } 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...