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>
typedef long long ll;
typedef long double ld;
using namespace std;
const int MX = 2e5 + 5;
ll x[MX], radius[MX];
ld ans[MX];
int main()
{
int N;
cin >> N;
for (int i = 0; i < N; i++)
cin >> x[i] >> radius[i];
stack<pair<ll, ld>> st;
for (int i = 0; i < N; i++)
{
ld r = radius[i];
while (!st.empty())
{
auto curr = st.top();
r = min(r, ((curr.first - x[i]) * (curr.first - x[i])) / (4 * curr.second));
if (r > curr.second)
st.pop();
else
break;
}
ans[i] = r;
st.push({x[i], r});
}
cout << fixed << setprecision(3);
for (int i = 0; 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... |