Submission #974142

#TimeUsernameProblemLanguageResultExecution timeMemory
974142AksLolCodingBalloons (CEOI11_bal)C++17
100 / 100
143 ms5596 KiB
#include <bits/stdc++.h> using namespace std; using ld = long double; using ld2 = array<ld, 2>; ld rad(ld2 prev, ld x) { return ((prev[0]-x)*(prev[0]-x)/(4*prev[1])); } int main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; // solve stack<ld2> check; while (n--) { ld x, r; cin >> x >> r; while (!check.empty()) { ld2 prev = check.top(); ld to_prev = rad(prev, x); r = min(r, to_prev); if (r >= prev[1]) check.pop(); else break; } check.push({x, r}); printf("%.3Lf\n", r); } }
#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...