Submission #998485

#TimeUsernameProblemLanguageResultExecution timeMemory
998485hippo123Balloons (CEOI11_bal)C++17
10 / 100
399 ms9296 KiB
#include <bits/stdc++.h> using namespace std; #define pr pair<double, int> #define ll long long #define pb push_back #define f first #define s second int main(){ int n; cin>>n; vector<double> x(n), r(n); for (int i=0;i<n; i++) cin>>x[i]>>r[i]; stack<pr> st; double ans[n]; for (int i=0; i<n; i++){ double br=r[i]; while(!st.empty() ){ br=min(br, (x[i]-x[st.top().s])*(x[i]-x[st.top().s])/(4*r[st.top().s])); if(br>st.top().f){ st.pop(); } else{ break; } } st.push({br, i}); ans[i]=br; } cout << fixed << setprecision(3); for (int i=0; i<n; i++) cout<<ans[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...