Submission #651921

#TimeUsernameProblemLanguageResultExecution timeMemory
651921womogenesBalloons (CEOI11_bal)C++14
30 / 100
306 ms13684 KiB
// https://oj.uz/problem/view/CEOI11_bal // Balloons #include <bits/stdc++.h> #define x first #define r second using namespace std; typedef vector<int> vi; typedef long double ld; int main() { int n; cin >> n; vector<pair<int, ld>> balls(n); for (int i = 0; i < n; i++) { cin >> balls[i].x >> balls[i].r; } // Stack algorithm stack<pair<int, ld>> st; vector<ld> radii(n); for (int i = 0; i < n; i++) { ld max_rad = balls[i].r; while (!st.empty()) { pair<int, ld> 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; } for (ld 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...