#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const int N=2e5+5;
int n,u,v;
ll x[N];
ld y[N];
stack <int> st;
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL); cout.tie(NULL);
cin >> n;
for (int i=1;i<=n;i++)
{
cin >> u >> v;
x[i]=u;
ld best=v;
while (!st.empty())
{
int j=st.top();
best=min(best,(x[i]-x[j])*(x[i]-x[j])/(4*y[j]));
if (best>=y[j]) st.pop();
else break;
}
y[i]=best;
st.push(i);
}
cout << fixed << setprecision(3);
for (int i=1;i<=n;i++)
cout << y[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... |