#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cin >> n;
double a[n][2];
for(int i = 0;i < n;i++){
cin >> a[i][0];
cin >> a[i][1];
}
stack<array<double,2>> x;
double res[n];
res[0] = a[0][1];
x.push({a[0][0],a[0][1]});
for(int i = 1;i < n;i++){
array<double,2> p;
double b = a[i][1];
while(!x.empty()){
p = x.top();
b = min(b,((a[i][0]-p[0])*(a[i][0]-p[0]))/(4*p[1]));
if(p[1] > b){
break;
}
x.pop();
}
res[i] = b;
x.push({a[i][0],b});
}
for(int i = 0;i < n;i++){
cout << fixed << setprecision(3);
cout << res[i] << endl;
}
}
# | 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... |