Submission #956311

#TimeUsernameProblemLanguageResultExecution timeMemory
956311codefoxBalloons (CEOI11_bal)C++14
100 / 100
446 ms5528 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int, double> #define ll long long int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); cout << fixed; cout << setprecision(3); int n; cin >> n; stack<pii> balloons; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; double sol = b; while (balloons.size()) { ll dn = a-balloons.top().first; double r = balloons.top().second; if ((r+b)*(r+b) >= dn*dn+(r-b)*(r-b)) { sol = min(sol, (dn*dn)/(4*r)); } if (r>sol)break; balloons.pop(); } balloons.push({a, sol}); cout << sol << "\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...