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>
using namespace std;
double f(int a,int b,double c,double d){
int dist=(b-a)*(b-a);
double ans=(double)dist/4;ans=(double)ans/d;
return (ans<c?ans:c);
}
void solve(){
int a;cin>>a;
vector<double> b(a),c(a);
for(int i=0;i<a;i++) cin>>b[i]>>c[i];
for(int i=0;i<a;i++){
stack<int> st;
int j=1;while(i>=j) {if((b[i]-b[i-j])<(c[i]+c[i-j])) st.push(i-j);j++;}
while(!st.empty()) {c[i]=f(b[i],b[st.top()],c[i],c[st.top()]);st.pop();}
cout<<fixed<<setprecision(3)<<c[i]<<endl;
}
}
int main(){
int t=1;
while(t--) solve();
}
# | 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... |