이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "iomanip"
using namespace std;
const long double EPS = 1e-9;
int main()
{
typedef long double ld;
int n; cin>>n; vector<pair<ld, ld>>arr(n);
for(int l=0;l<n;l++) cin>>arr[l].first>>arr[l].second;
stack<pair<ld, pair<ld, ld>>>s;
/// S.first -> Radius || S.second.first -> X || S.second.second -> Y
for(int l=0;l<n;l++) {
ld lo=0.0, hi=arr[l].second, ans=0.0;
for(int i=0;i<=50;i++) {
stack<pair<ld, pair<ld, ld>>>cp=s;
ld mid=(lo+hi)/2.0; bool can=true;
while(!cp.empty()) {
ld r1=cp.top().first, x1=cp.top().second.first, y1=cp.top().second.second;
ld r2=mid, x2=arr[l].first, y2=mid;
ld r=fabs(r1-r2), d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
if(r*r<=d&&d<=(r1+r2)*(r1+r2)) can=false;
cp.pop();
}
if(can) { ans=mid; lo=mid; }
else { hi=mid; }
}
cout<<setprecision(3)<<fixed<<ans<<endl;
s.push({ans, {arr[l].first, ans}});
}
}
# | 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... |