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(){
int n; cin >> n;
vector<int> x(n), r(n);
for (int i=0; i<n; i++){
cin >> x[i] >> r[i];
}
vector<float> res(n);
res[0] = r[0];
int last_idx = 0;
for (int i=1; i<n; i++){
float r1 = float((x[i]-x[i-1]) * (x[i]-x[i-1])) / float(4 * res[i-1]);
float r_last = float((x[i]-x[last_idx]) * (x[i]-x[last_idx])) / float(4 * res[last_idx]);
res[i] = min(float(r[i]), min(r1, r_last));
if(r1 < r_last){
last_idx = i;
}
}
for (float a : res) cout << fixed << setprecision(3) << a << 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... |