This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
using ld = long double;
const ld eps = 1e-9;
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
int N; cin >> N;
vector<pair<int, ld>> A;
for(int i = 0; i < N; i++) {
int x, r; cin >> x >> r;
ld ans = r;
while(size(A)) {
ld D = ld(x - A.back().first) * ld(x - A.back().first);
ld R = min(ld(r), D / (4 * A.back().second));
if ((ans - R) > 0) ans = R;
// cout << ans - R << " - " << x << endl;
if (ans+eps > A.back().second) A.pop_back();
else break;
}
cout << ans << nl;
A.push_back({x, ans});
}
return 0;
}
# | 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... |