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;
int main()
{
cout << fixed << setprecision(3);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<long double, long double>> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i].first >> a[i].second;
}
stack<pair<long double, long double>> s;
long double d;
vector<long double> ans(n);
for (int i = 0; i < n; i++)
{
d = a[i].second;
while (1)
{
if (s.empty())
{
s.push({a[i].first, d});
ans[i] = d;
break;
}
d = min(d, (s.top().first - a[i].first) * (s.top().first - a[i].first) / (4 * s.top().second));
if (d < s.top().second)
{
s.push({a[i].first, d});
ans[i] = d;
break;
}
else
{
s.pop();
}
}
}
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... |