이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
int n;
cin >> n;
stack<pair<double, pair<double, double>>> hi; // position, radius
while (n--)
{
double x, r;
cin >> x >> r;
double radius = r;
while (hi.size() && x > hi.top().first)
{
hi.pop();
}
if (!hi.size())
{
hi.push({1000000002, {radius, x}});
cout << fixed << setprecision(3) << radius << '\n';
}
else
{
auto u = hi.top();
radius = min(r, pow(x - u.second.second, 2) / 4.0 / u.second.first);
cout << fixed << setprecision(3) << radius << '\n';
while (hi.size())
{
if (radius >= hi.top().second.first)
{
hi.pop();
continue;
}
double d = sqrt(radius / hi.top().second.first);
double g = (x - d * hi.top().second.second) / (1 - d);
if (g >= hi.top().first)
{
hi.pop();
}
else
break;
}
if (hi.size())
{
double d = sqrt(radius / hi.top().second.first);
double g = (x - d * hi.top().second.second) / (1 - d);
hi.push({g, {radius, x}});
}
else
{
hi.push({1000000002, {radius, x}});
}
}
cout << "";
}
}
# | 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... |