이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define long long long
using namespace std;
double calcr(pair<double,double> pr, double xc)
{
return (pr.first-xc)*(pr.first-xc)/(4*pr.second);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
stack<pair<double,double>> st;
vector<double> ans(n);
for(int i=0; i<n; i++)
{
double x,r;
cin>>x>>r;
double max_r=r;
while(!st.empty())
{
pair<double,double> prev=st.top();
double new_r=calcr(prev,x);
max_r=min(new_r,max_r);
if(max_r>=prev.second)
{
st.pop();
continue;
}
else
{
break;
}
}
st.push({x, max_r});
ans[i]=max_r;
}
cout<<fixed<<setprecision(3);
for (double &r : ans) { cout << r << "\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... |