This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//in the neme of god
#include <bits/stdc++.h>
using namespace std;
stack <int> st;
const int MAX_N = 2e5 + 10;
double n, x[MAX_N], r[MAX_N], ans[MAX_N];
int main(){
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i] >> r[i];
ans[i] = r[i];
while (st.size()) {
double tmp = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4. * ans[st.top()]);
ans[i] = min(ans[i], tmp);
if (ans[st.top()] < ans[i])
st.pop();
else
break;
}
st.push(i);
}
for (int i = 0; i < n; i++)
cout << fixed << setprecision(3) << ans[i] << '\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... |