#include<bits/stdc++.h>
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define mod 1'000'000'007
#define inf 1'000'000'000'000'00
#define pb push_back
#define vvi vector<vi>
#define fst ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int x[200005], r[200005];
signed main(){
fst
int n; cin >> n;
for(int i = 0; i < n; i++){
cin >> x[i] >> r[i];
}
vector<double> ans(n);
stack<int> bl;
for(int i = 0; i < n; i++){
ans[i] = r[i];
while(!bl.empty()){
int j = bl.top();
int d = x[i] - x[j];
double res = (double)d*d / (4*ans[j]);
ans[i] = min(ans[i], res);
if(ans[i] >= ans[j]) bl.pop();
else break;
}
bl.push(i);
}
cout << fixed << setprecision(3);
for(int i = 0; i < n; i++) cout << ans[i] << '\n';
}
# | 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... |