#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pll pair<ll, ll>
#define ppll pair< pair<long long, long long>, long long >
#define ff first
#define ss second
#define pb push_back
#define pf push_front
const ll DIM = 1e6 + 7;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
const ll maxlog = 20;
const ll bsize = 350;
ld x[DIM], r[DIM];
void solve() {
ll n;
cin >> n;
stack<ll> st;
for (int i=1; i<=n; i++) {
cin >> x[i] >> r[i];
while (!st.empty()) {
ll j = st.top();
r[i] = min(r[i], (ld)(x[i] - x[j])*(x[i] - x[j]) / (ld)(4 * r[j]));
if (r[i] >= r[j]) st.pop();
else break;
}
st.push(i);
}
for (int i=1; i<=n; i++) cout << fixed << setprecision(3) << r[i] << " ";
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
//freopen("248.in", "r", stdin);
//freopen("248.out", "w", stdout);
int ntest = 1;
//cin >> ntest;
while (ntest--) {
solve();
}
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... |