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 <iostream>
#include <iomanip>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
int pila[n];
long double x[n];
long double r[n];
long double ans[n];
for(int i=0;i<n;i++){
cin >> x[i] >> r[i];
}
pila[0] =0;
int index = 0;
for(int i=0;i<n;i++){
if(i==0){
ans[0] = r[0];
}
else{
bool first = true;
long double k;
while (index >= 0){
if(first){
k = min(r[i],((x[i]-x[pila[index]])/(4*ans[pila[index]]))*(x[i]-x[pila[index]]));
first = false;
}
else{
k = min(k,((x[i]-x[pila[index]])/(4*ans[pila[index]]))*(x[i]-x[pila[index]]));
}
if(k<=ans[index]){
break;
}
pila[index] = 0;
index--;
}
ans[i] = k;
pila[index+1] = i;
index++;
}
cout << fixed << setprecision(6) << ans[i] << "\n";
}
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... |