#include<iostream>
#include<queue>
#include<iomanip>
using namespace std;
long double getrad(long double x, long double xx, long double rr)
{
long double r=((x-xx)*(x-xx))/(4*rr);
return r;
}
deque<pair<long double,long double> > Q;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
long double x,rmax;
cin>>x>>rmax;
long double r=rmax;
while(!Q.empty())
{
long double xx=Q.back().first;
long double rr=Q.back().second;
r=min(r,getrad(x,xx,rr));
if(r>rr)
Q.pop_back();
else
break;
}
cout<<setprecision(3)<<fixed<<r<<"\n";
Q.push_back({x,r});
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
384 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
768 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
1524 KB |
50000 numbers |
2 |
Correct |
72 ms |
2428 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
157 ms |
1912 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
2152 KB |
115362 numbers |
2 |
Correct |
170 ms |
5728 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
2300 KB |
154271 numbers |
2 |
Correct |
286 ms |
8784 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
2444 KB |
200000 numbers |
2 |
Correct |
285 ms |
8844 KB |
199945 numbers |