Submission #1005055

#TimeUsernameProblemLanguageResultExecution timeMemory
1005055MubarisBalloons (CEOI11_bal)C++17
0 / 100
3 ms524 KiB
#include<bits/stdc++.h> using namespace std; #define INF(t) numeric_limits<t>::max() double f(int a,int b,int c,int d){ int dist=(b-a)*(b-a); double ans=(double)dist/4;ans=(double)ans/d; return (ans<=c?ans:0); } void solve(){ int a;cin>>a; vector<int> b(a),c(a); stack<int> st; for(int i=0;i<a;i++) cin>>b[i]>>c[i]; for(int i=0;i<a;i++){ double ans=(double)c[i]; while(!st.empty()&&f(b[i],b[st.top()],c[i],c[st.top()])) {ans=f(b[i],b[st.top()],c[i],c[st.top()]);st.pop();} st.push(i); cout<<fixed<<setprecision(3)<<ans<<endl; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0); #ifndef ONLINE_JUDGE (void)!freopen("input.txt", "r", stdin); (void)!freopen("info.txt", "w", stderr); (void)!freopen("output.txt", "w", stdout); #endif int t=1; while(t--) solve(); #ifndef ONLINE_JUDGE cerr << "time taken: " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; #endif }
#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...