Submission #872166

#TimeUsernameProblemLanguageResultExecution timeMemory
87216612345678Balloons (CEOI11_bal)C++17
40 / 100
2 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int nx=2e3+5; double n, x[nx], dp[nx]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) cin>>x[i]>>dp[i]; stack<pair<int, double>> s; for (int i=1; i<=n; i++) { while (!s.empty()) { dp[i]=min(dp[i], (((x[i]-x[s.top().first])*(x[i]-x[s.top().first]))/(4*s.top().second))); if (dp[i]>=s.top().second) s.pop(); else break; } printf("%.3f\n", dp[i]); s.push({i, dp[i]}); } }
#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...