Submission #1095905

#TimeUsernameProblemLanguageResultExecution timeMemory
1095905dpsaveslivesBalloons (CEOI11_bal)C++17
100 / 100
140 ms6992 KiB
#include <bits/stdc++.h> #define ff first #define ss second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); stack<pair<double,double>> st; int N; cin >> N; vector<double> ans(N); for(int i = 0;i<N;++i){ double x,r; cin >> x >> r; double res = r; while(!st.empty()){ double bx = st.top().ff, rx = st.top().ss; double tmp = (x-bx)*(x-bx)/(4*rx); res = min(res,tmp); if(res >= rx){ st.pop(); continue; } break; } ans[i] = res; st.push({x,res}); } cout << fixed << setprecision(3); for(int i = 0;i<N;++i){ cout << ans[i] << "\n"; } 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...