Submission #1059672

#TimeUsernameProblemLanguageResultExecution timeMemory
1059672MazhavilBalloons (CEOI11_bal)C++17
30 / 100
152 ms7512 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*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<<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...