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 <vector>
#include <stack>
#include <iomanip>
using namespace std;
const long double EPS=1e-9;
long double dist(int x,long double r1,int y){
return (long double)(x-y)*(x-y)/(4*r1);
}
int main(){
int n,x;
long double r;
cin>>n;
stack<pair<int,long double>> st;
for(int i=0;i<n;i++){
cin>>x>>r;
while(st.size()){
long double ok=dist(st.top().first,st.top().second,x);
r=min(r,ok);
if(ok>=st.top().second)st.pop();
else break;
//cout<<st.size()<<'\n';
}
st.push({x,r});
cout<<fixed<<setprecision(10)<<r<<'\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... |