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 ff first
#define ss second
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
stack<pair<double,double>> st;
int N; cin >> N;
vector<double> ans(N);
for(int i = 0;i<N;++i){
double x,r; cin >> x >> r;
double res = r;
while(!st.empty()){
double bx = st.top().ff, rx = st.top().ss;
double tmp = (x-bx)*(x-bx)/(4*rx);
res = min(res,tmp);
if(res >= rx){
st.pop();
continue;
}
break;
}
ans[i] = res;
st.push({x,res});
}
cout << fixed << setprecision(3);
for(int i = 0;i<N;++i){
cout << 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... |