Submission #847877

#TimeUsernameProblemLanguageResultExecution timeMemory
847877gtm7Balloons (CEOI11_bal)C++17
10 / 100
157 ms13904 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; } else if (s.top().second > a[i].second) { d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second)); s.push({a[i].first, d}); ans[i] = d; break; } else { d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second)); 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...