Submission #847886

#TimeUsernameProblemLanguageResultExecution timeMemory
847886gtm7Balloons (CEOI11_bal)C++17
100 / 100
165 ms14928 KiB
#include <bits/stdc++.h> using namespace std; int main() { cout << fixed << setprecision(3); ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<long double, long double>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } stack<pair<long double, long double>> s; long double d; vector<long double> ans(n); for (int i = 0; i < n; i++) { d = a[i].second; while (1) { if (s.empty()) { s.push({a[i].first, d}); ans[i] = d; break; } d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second)); if (d < s.top().second) { s.push({a[i].first, d}); ans[i] = d; break; } else { s.pop(); } } } 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...