Submission #840898

#TimeUsernameProblemLanguageResultExecution timeMemory
840898PagodePaivaBalloons (CEOI11_bal)C++17
10 / 100
228 ms4904 KiB
#include<bits/stdc++.h> #define N 200010 #define int long long #define double long double using namespace std; double res[N]; int32_t main(){ int n; cin >> n; stack <pair <double, double>> s; s.push({0, 0}); cout << fixed << setprecision(3); for(int i = 1;i <= n;i++){ double a, b; cin >> a >> b; while(!s.empty()){ auto [x, y] = s.top(); // cout << x << ' ' << y << '\n'; if(y == 0){ res[i] = b; break; } res[i] = min(b, ((a-x)*(a-x))/(4*y)); b = max(b, res[i]); if(res[i] >= y){ s.pop(); } else{ // cout << y << "\n"; break; } } s.push({a, res[i]}); } for(int i = 1;i <= n;i++){ cout << res[i] << '\n'; } }
#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...