#include <bits/stdc++.h>
using namespace std;
pair <long double,long double> centru[200005],p1;
long double raza[200005];
struct wow
{
long double loc,raza;
}v[200005];
long double dist (pair <long double , long double> p1, pair <long double,long double> p2)
{
return (p1.first-p2.first)*(p1.first-p2.first)+(p1.second-p2.second)*(p1.second-p2.second);
}
bool ok(long double mij,int indice)
{
int i;
p1={v[indice].loc,mij};
for (i=indice-1;i>=1;i--)
{
if (dist(p1,centru[i])-(raza[i]+mij)*(raza[i]+mij)<1e-6)
{
return 0;
}
}
return 1;
}
int n,i;
long double st,dr,mij,sol;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n;
for (i=1;i<=n;i++)
{
cin>>v[i].loc>>v[i].raza;
st=1e-6;
dr=v[i].raza;
sol=0;
while (dr-st>1e-6)
{
mij=(st+dr)/2;
if (ok(mij,i)==1)
{
sol=mij;
st=mij+1e-6;
}
else
{
dr=mij-1e-6;
}
}
raza[i]=sol;
centru[i]={v[i].loc,sol};
}
for (i=1;i<=n;i++)
{
cout<<fixed<<setprecision(3)<<raza[i]<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
384 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
504 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2069 ms |
1120 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2086 ms |
1048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2090 ms |
1016 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2099 ms |
1016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2099 ms |
1004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2082 ms |
1080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |