Submission #729760

#TimeUsernameProblemLanguageResultExecution timeMemory
729760vjudge1Balloons (CEOI11_bal)C++17
100 / 100
562 ms7000 KiB
#include <iostream> #include <stack> #include <iomanip> using namespace std; double res[1000005]; int main() { int n; cin >> n; stack<pair<double, double>> s; for (int i = 0; i < n; i++){ double x, r, mi; cin >> x >> r; mi = r; while (!s.empty()) { pair<double, double> p = s.top(); mi = min(mi, (p.first - x) * (p.first - x) / (p.second * 4)); if (mi >= p.second) { s.pop(); } else break; } s.push(make_pair(x, mi)); res[i] = mi; } cout << fixed << setprecision(3); for (int i = 0; i < n; i++) { cout << res[i] << endl; } }
#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...