Submission #403083

#TimeUsernameProblemLanguageResultExecution timeMemory
403083ruadhanBalloons (CEOI11_bal)C++17
100 / 100
301 ms11480 KiB
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; const int MX = 2e5 + 5; ll x[MX], radius[MX]; ld ans[MX]; int main() { int N; cin >> N; for (int i = 0; i < N; i++) cin >> x[i] >> radius[i]; stack<pair<ll, ld>> st; for (int i = 0; i < N; i++) { ld r = radius[i]; while (!st.empty()) { auto curr = st.top(); r = min(r, ((curr.first - x[i]) * (curr.first - x[i])) / (4 * curr.second)); if (r > curr.second) st.pop(); else break; } ans[i] = r; st.push({x[i], r}); } 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...