// soab
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define fi first
#define se second
void io() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
// freopen(".INP", "r", stdin);
// freopen(".OUT", "w", stdout);
}
double calc(pair<double,double> a, pair<double,double> b) {
return (a.fi - b.fi) * (a.fi - b.fi) / (4 * b.se);
}
signed main() {
io();
int n; cin >> n;
vector<pair<double,double>> a(n);
for(int i = 0; i < n; i++) {
double x, r; cin >> x >> r;
a[i] = {x, r};
}
stack<pair<double,double>> st;
vector<double> ans;
for(int i = 0; i < n; i++) {
auto [bx, br] = a[i];
while(!st.empty()) {
auto [ax, ar] = st.top();
br = min(br, calc(a[i], st.top()));
if(br >= ar) {
st.pop();
} else {
break;
}
}
st.push({bx, br});
ans.push_back(br);
}
for(auto i : ans) {
cout << fixed << setprecision(3) << i << nl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |