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;
typedef double d64;
typedef long long i64;
typedef pair<int, int> pii;
#define MP make_pair
#define ss second
#define ff first
const int mxn = 1e6 + 10;
d64 x[mxn], r[mxn], ans[mxn];
int n;
d64 mx(int L, int R) {
d64 dx = x[R] - x[L];
return dx * dx / (4.0 * ans[L]);
}
int main() {
cin >> n;
for(int i = 1; i <= n; i++)
cin >> x[i] >> r[i];
ans[1] = r[1];
vector<int> vec;
vec.push_back(1);
for(int i = 2; i <= n; i++) {
while(vec.size() > 1 && mx(vec.back(), i) <= mx(vec[vec.size() - 1], i))
vec.pop_back();
ans[i] = min(mx(vec.back(), i), r[i]);
vec.push_back(i);
}
cout << fixed << setprecision(3);
for(int i = 1; i <= n; i++)
cout << ans[i] << '\n';
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... |