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>
#define int long long
using namespace std;
const int maxn = 2e5 + 10;
struct ball {
double x, r;
};
int n;
ball a[maxn];
double ra[maxn];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> a[i].x >> a[i].r;
ra[i] = a[i].r;
}
deque <ball> d;
for(int i = 1; i <= n; ++i) {
while(!d.empty()) {
ball tmp = d.back();
ra[i] = min(ra[i], (a[i].x - tmp.x)*(a[i].x - tmp.x) / (4*tmp.r));
if(ra[i] >= tmp.r) d.pop_back();
else break;
}
d.push_back(a[i]);
}
for(int i = 1; i <= n; ++i) {
cout << fixed << setprecision(3) << ra[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... |