Submission #713623

#TimeUsernameProblemLanguageResultExecution timeMemory
713623Azther0zBalloons (CEOI11_bal)C++11
100 / 100
592 ms7172 KiB
#include <bits/stdc++.h> using namespace std; double cal(double x1,double x2,double r1) { return (x2-x1)*(x2-x1)/(4*r1); } int main() { int n; cin >> n; stack<pair<double,double>> stk; //{x,r} vector<double> result; while(n--) { double x,r; cin >> x >> r; double maxr=r; while(!stk.empty()) { maxr=min(maxr,cal(stk.top().first,x,stk.top().second)); if(maxr>=stk.top().second) stk.pop(); else break; } stk.push({x,maxr}); result.push_back(maxr); } cout << fixed << setprecision(3); for(auto r:result) cout << r << 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...