Submission #1030143

#TimeUsernameProblemLanguageResultExecution timeMemory
1030143ArthuroWichBalloons (CEOI11_bal)C++17
100 / 100
306 ms11860 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int struct bal { int x, r; }; void solve() { int n; cin >> n; vector<long double> ans(n); vector<bal> p(n); for (int i = 0; i < n; i++) { cin >> p[i].x >> p[i].r; ans[i] = p[i].r; } vector<pair<long double, int>> st; for (int i = 0; i < n; i++) { while(!st.empty()) { long double delta = abs(p[i].x-p[st.back().second].x); ans[i] = min(ans[i], (long double) delta*delta/((long double)4.0L*st.back().first)); if (ans[i] >= st.back().first) { st.pop_back(); } else { break; } } st.push_back({ans[i], i}); } for (int i = 0; i < n; i++) { cout << fixed << setprecision(3) << ans[i] << endl; } } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; while(t--) { solve(); } }
#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...