Submission #669085

#TimeUsernameProblemLanguageResultExecution timeMemory
669085kirakaminski968Balloons (CEOI11_bal)C++17
100 / 100
655 ms6976 KiB
#include <bits/stdc++.h> using namespace std; double calc(pair<double,double> a,double bx){ return (a.first-bx)*(a.first-bx)/(4*a.second); } int n; int main() { cin >> n; vector<double> answer(n); stack<pair<double,double>> s; for(int i = 0;i<n;i++){ double x,r; cin >> x >> r; double ans = r; while(!s.empty()){ pair<double,double> cur = s.top(); ans = min(ans,calc(cur,x)); if(ans >= cur.second){ s.pop(); continue; } break; } s.push(make_pair(x,ans)); answer[i] = ans; } cout << fixed << setprecision(3); for(int i = 0;i<n;i++){ cout << answer[i] << endl; } 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...