Submission #770303

#TimeUsernameProblemLanguageResultExecution timeMemory
770303lukehsiaoBalloons (CEOI11_bal)C++14
100 / 100
116 ms5400 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 2e5; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; cout << fixed << setprecision(3); stack<pair<int, double>> st; for (int i=0, x, r; i<n; ++i) { cin >> x >> r; double mr = r; while (!st.empty()) { int tx = st.top().first; double tr = st.top().second; double dx = x - tx; mr = min(mr, dx * dx / (4 * tr)); if (mr >= tr) st.pop(); else break; } st.push({x, mr}); cout << mr << '\n'; } }
#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...