Submission #991240

#TimeUsernameProblemLanguageResultExecution timeMemory
991240BF001Balloons (CEOI11_bal)C++17
100 / 100
126 ms7052 KiB
#include <bits/stdc++.h> using namespace std; #define N 200005 #define fi first #define se second typedef pair<double, double> ii; double res[N]; int n; double cal(ii a, double bx){ return (bx - a.fi) * (bx - a.fi) / (4 * a.se); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); stack<ii> st; cin >> n; for (int i = 1; i <= n; i++){ double r, x; cin >> x >> r; double mi = r; while (!st.empty()){ ii tmp = st.top(); mi = min(mi, cal(tmp, x)); if (mi >= tmp.se) st.pop(); else break; } st.push({x, mi}); res[i] = mi; } cout << fixed << setprecision(3) ; for (int i = 1; i <= n; i++){ cout << res[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...