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;
int main(){
// freopen("main.in", "r", stdin);
// freopen(".out", "w", stdout);
long long n; cin >> n;
long double x[n], r[n], r_f[n];
for (long long i = 0; i < n; i++) cin >> x[i] >> r[i];
stack<long long> st;
for (long long i = 0; i < n; i++){
while (st.size()) {
long double rad = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4 * r_f[st.top()]);
r[i] = min(r[i], rad);
if (r[i] >= r_f[st.top()]) {
st.pop();
continue;
} else break;
}
r_f[i] = r[i];
st.push(i);
}
cout << fixed << setprecision(3);
for (long long i = 0; i < n; i++) cout << r_f[i] << endl;
}
# | 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... |