Submission #998611

#TimeUsernameProblemLanguageResultExecution timeMemory
998611hippo123Balloons (CEOI11_bal)C++17
100 / 100
439 ms11876 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]-st.top().s)*(x[i]-st.top().s)/(4*st.top().f)); if(br>st.top().f){ st.pop(); } else{ break; } } st.push({br, x[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...