Submission #788307

#TimeUsernameProblemLanguageResultExecution timeMemory
788307math_piBalloons (CEOI11_bal)C++14
10 / 100
150 ms6000 KiB
#include<bits/stdc++.h> using namespace std; double calc(pair<double, double> p, double x) { return (p.first - x) * (p.first - x) / (4 * p.second); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<double> res(n); stack<pair<double, double>> st; for(int i=0; i<n; i++) { double x, r; cin >> x >> r; double max_r = r; while(!st.empty()) { pair<double, double> last = st.top(); double last_r = calc(last, x); max_r = min(max_r, last_r); if(max_r >= last.second) { st.pop(); } else break; } res[i] = max_r; st.push({x, r}); } cout << fixed << setprecision(3); for(auto &x: res) cout << x << ' '; }
#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...