이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |