#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> x(n), r(n);
vector<double> final_radius(n);
for (int i = 0; i < n; ++i) {
cin >> x[i] >> r[i];
}
final_radius[0] = r[0];
for (int i = 1; i < n; ++i) {
final_radius[i] = r[i];
for (int j = i - 1; j >= 0; --j) {
long long dist = x[i] - x[j];
if (dist < final_radius[i] + final_radius[j]) {
final_radius[i] = dist - final_radius[j];
}
}
}
cout << fixed << setprecision(3);
for (double radius : final_radius) {
cout << radius << 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... |