#include <bits/stdc++.h>
using namespace std;
struct Balloon
{
long double x,r;
};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
vector<Balloon> s;
s.reserve(n);
for(int i=0; i<n; i++)
{
long double xi,ri;
cin>>xi>>ri;
long double current=ri;
while(!s.empty())
{
const Balloon& prev=s.back();
long double limit=(xi-prev.x)*(xi-prev.x)/(4.0*prev.r);
if(limit<current)
{
current=limit;
}
if(current>=prev.r)
{
s.pop_back();
}
else
{
break;
}
}
s.push_back({xi,current});
cout<<fixed<<setprecision(3)<<current<<endl;
}
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... |