This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define N 200010
#define int long long
using namespace std;
double res[N];
int32_t main(){
int n;
cin >> n;
stack <pair <double, double>> s;
s.push({0, 0});
cout << fixed << setprecision(3);
for(int i = 1;i <= n;i++){
double a, b;
cin >> a >> b;
while(!s.empty()){
auto [x, y] = s.top();
// cout << x << ' ' << y << '\n';
if(y == 0){
res[i] = b;
break;
}
res[i] = min(b, ((a-x)*(a-x))/(4*y));
// cout << res[i] << ' ';
if(res[i] >= y){
s.pop();
}
else{
// cout << y << "\n";
break;
}
}
s.push({a, res[i]});
}
for(int i = 1;i <= n;i++){
cout << res[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... |