Submission #447699

#TimeUsernameProblemLanguageResultExecution timeMemory
447699Sneha_codesBalloons (CEOI11_bal)C++14
100 / 100
750 ms8516 KiB
#include <bits/stdc++.h> #define f first #define s second #define N 200005 #define int long long using namespace std; double pos[N],rad[N]; stack<pair<double,double>> st; double inflate(double x,double r) { while (!st.empty()) { double x1 = st.top().f, r1 = st.top().s; r = min(r, ((x1 - x) * (x1 - x)) / (4 * r1)); if (r >= r1) st.pop(); else break; } st.push({x, r}); return r; } signed main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> pos[i] >> rad[i]; for (int i = 0; i < n; i++) cout << fixed<<setprecision(3)<<inflate(pos[i], rad[i]) << endl; }
#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...