Submission #923724

#TimeUsernameProblemLanguageResultExecution timeMemory
923724vaneaBalloons (CEOI11_bal)C++14
100 / 100
164 ms2384 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; double calc_r(array<double, 2> a, double x) { return (a[0] - x) * (a[0] - x) / (4 * a[1]); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; stack<array<double, 2>> s; cout << fixed << setprecision(5); for(int i = 0; i < n; i++) { double x, r; cin >> x >> r; double mx_r = r; while(!s.empty()) { auto last = s.top(); double curr = calc_r(last, x); mx_r = min(mx_r, curr); if(mx_r >= last[1]) { s.pop(); continue; } break; } s.push({x, mx_r}); cout << mx_r << '\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...