제출 #1294115

#제출 시각아이디문제언어결과실행 시간메모리
1294115sritthebossBalloons (CEOI11_bal)C++20
0 / 100
234 ms7952 KiB
#include "bits/stdc++.h" #define INF 1e18 using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<double, double>> balloons(n); for (int i = 0; i < n; i++) { cin >> balloons[i].first >> balloons[i].second; } stack<pair<double, double>> s; vector<double> ans(n); for (int i = 0; i < n; i++) { pair<double, double> b = balloons[i]; if (s.empty()) { ans[i] = b.second; s.push(b); } else { while (!s.empty()) { double new_r = pow(s.top().first - b.first, 2) / (4 * s.top().second); new_r = min(new_r, b.second); if (new_r > s.top().second) { s.pop(); } else { s.push(b); ans[i] = new_r; break; } } } } for (int i = 0; i < n; i++) { cout << fixed << setprecision(3) << ans[i] << 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...