제출 #1288826

#제출 시각아이디문제언어결과실행 시간메모리
1288826IskachunBalloons (CEOI11_bal)C++20
100 / 100
100 ms4400 KiB
//{ #include <iostream> #include <iomanip> #include <vector> #include <array> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <cmath> #include <numeric> #include <cstring> #include <unordered_map> #include <unordered_set> #include <climits> #include <bitset> //} using namespace std; typedef long long ll; double sq (double a) { return a * a; } double f (pair<double, double> a, double x) { return sq(a.first - x) / (4 * a.second); } void solve() { int n; cin >> n; vector<double> ans(n); stack<pair<double, double>> st; for (int i = 0; i < n; i++) { double x, r; cin >> x >> r; double mx = r; while (st.size()) { auto prev = st.top(); auto val = f(prev, x); mx = min(mx, val); if (mx >= prev.second) st.pop(); else break; } st.push({x, mx}); ans[i] = mx; } cout << fixed << setprecision(3); for (auto x : ans) cout << x << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while (t--) solve(); }
#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...