Submission #443128

#TimeUsernameProblemLanguageResultExecution timeMemory
443128prvocisloBalloons (CEOI11_bal)C++17
100 / 100
247 ms8132 KiB
// aww geometria !! :) #include <bits/stdc++.h> typedef long double ld; using namespace std; ld maxr(ld x1, ld r1, ld x2) { ld x = r1, z = x2 - x1; return (z * z) / (4. * x); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(3); int n; cin >> n; vector<ld> x(n), r(n); vector<int> st; for (int i = 0; i < n; i++) { cin >> x[i] >> r[i]; while (!st.empty()) { r[i] = min(r[i], maxr(x[st.back()], r[st.back()], x[i])); if (r[i] > r[st.back()] - 1e-10) st.pop_back(); else break; } st.push_back(i); } for (int i = 0; i < n; i++) cout << r[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...