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 <stack>
#include <utility>
#include <iomanip>
using namespace std;
int n;
stack<pair<double,double>> stk;
int main(){
cin >> n;
cout << fixed << setprecision(3);
for(int i=1;i<=n;i++){
double x,r;
cin >> x >> r;
while(stk.size()>0){
double x2=stk.top().first,r2=stk.top().second;
r = min(r,(x2-x)*(x2-x)/4/r2);
if(r<r2){
break;
}
else{
stk.pop();
}
}
stk.push({x,r});
cout << r << "\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... |