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;
long double X[200001],R[200001];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("BongBong.INP","r",stdin);
//freopen("BongBong.OUT","w",stdout);
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> X[i] >> R[i];
printf("%.3Lf\n",R[1]);
stack<pair<long double, long double> > st;
st.push({X[1],R[1]});
for (int i = 2; i <= n; i++) {
while (!st.empty()) {
long double x = st.top().first, r = st.top().second;
R[i] = min(R[i],(X[i] - x)*(X[i]-x)/(4*r));
if (R[i] >= r) st.pop();
else break;
}
st.push({X[i],R[i]});
printf("%.3Lf\n",R[i]);
}
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... |