Submission #921184

#TimeUsernameProblemLanguageResultExecution timeMemory
9211840x34cBalloons (CEOI11_bal)C++17
100 / 100
160 ms5716 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pdd pair<double, double> #define endl '\n' using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N; cin >> N; auto calc_r = [](pdd &a, double x) { return ((x - a.first)*(x - a.first))/(4*a.second); }; stack<pdd> st; for(int i = 0; i < N; i++) { double x, r; cin >> x >> r; double max_r = r; while(!st.empty()) { pdd tp = st.top(); max_r = min(max_r, calc_r(tp, x)); if(max_r >= tp.second) st.pop(); else break; } st.push({x, max_r}); cout << fixed << setprecision(4) << max_r << endl; } }
#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...