Submission #1059696

#TimeUsernameProblemLanguageResultExecution timeMemory
1059696MazhavilBalloons (CEOI11_bal)C++17
100 / 100
168 ms9812 KiB
#include<bits/stdc++.h> using namespace std; void solve(){ int n;cin>>n; vector<int>x(n), limit(n); for(int i=0;i<n;i++)cin>>x[i]>>limit[i]; vector<double>radius(n); stack<int>st; for(int i=0;i<n;i++){ double val_i = 1.0*limit[i]; while(!st.empty()){ // just touching the balloon; double curr = 1.0*(x[i]-x[st.top()])*(x[i]-x[st.top()])/(4.0*radius[st.top()]); if(curr < val_i){ val_i = curr; } if(val_i >= radius[st.top()]){ st.pop(); }else{ break; } } st.push(i); radius[i]=val_i; } for(int i=0;i<n;i++)cout<<fixed<<setprecision(9)<<radius[i]<<" "; cout<<endl; } int main(){ int tt=1; //cin>>tt; while(tt--){ solve(); } 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...