#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);
}
long double raza1 (long double poz,int ind)
{
return ((poz-v[ind].loc)*(poz-v[ind].loc))/(4*raza[ind]);
}
int n,i;
long double st,dr,mij,sol,minim;
deque <int> d;
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;
minim=v[i].raza;
while (!d.empty())
{
minim=min(minim,raza1(v[i].loc,d.back()));
if (minim>raza[d.back()])
{
d.pop_back();
}
else
{
break;
}
}
raza[i]=minim;
d.push_back(i);
}
for (i=1;i<=n;i++)
{
cout<<fixed<<setprecision(3)<<raza[i]<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
1 ms |
384 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
1408 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
3728 KB |
50000 numbers |
2 |
Correct |
81 ms |
4120 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
135 ms |
7160 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
153 ms |
8364 KB |
115362 numbers |
2 |
Correct |
142 ms |
9336 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
200 ms |
11096 KB |
154271 numbers |
2 |
Correct |
235 ms |
15232 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
259 ms |
13944 KB |
200000 numbers |
2 |
Correct |
237 ms |
15352 KB |
199945 numbers |