//Dost SEFEROĞLU
#include <bits/stdc++.h>
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int inf = 2e18,MOD = 1e9+7,N = 2e5+1;
void solve() {
int n;
cin >> n;
vi x(n+1),r(n+1);
for (int i=1;i<=n;i++) cin >> x[i] >> r[i];
stack<pii> stk;
cout << setprecision(12);
double four = 4.0;
for (int i=1;i<=n;i++) {
int x2 = x[i];
double maxr = r[i];
while (!stk.empty()) {
auto[x1,r1] = stk.top();
maxr = min(maxr,((x2-x1)*(x2-x1))/(four*r1));
if (maxr >= r1) stk.pop();
else break;
}
stk.push({x[i],maxr});
cout << maxr << " ";
}
}
int32_t main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#ifdef Dodi
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);/*
#else
freopen("fcolor.in","r",stdin);
freopen("fcolor.out","w",stdout); */
#endif
int t = 1;
//cin >> t;
while (t --> 0) solve();
}
# | 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... |