Submission #446964

#TimeUsernameProblemLanguageResultExecution timeMemory
446964maximath_1Balloons (CEOI11_bal)C++11
100 / 100
569 ms5528 KiB
#include <iostream> #include <math.h> #include <stack> #include <iomanip> using namespace std; #define ld long double const int MX = 2e5 + 5; const ld eps = 1e-10; int n; struct ball{ int ps; ld r; }; stack<ball> s; int main(){ cin.tie(0) -> sync_with_stdio(0); cin >> n; for(int p, r, i = 0; i < n; i ++){ cin >> p >> r; ld mxR = r; while(!s.empty()){ ld c = (s.top().ps - p) * 1.0L * (s.top().ps - p); mxR = min(mxR, c / (4.0L * s.top().r)); if(mxR > s.top().r - eps) s.pop(); else break; } cout << fixed << setprecision(3) << mxR << endl; s.push((ball){p, mxR}); } 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...