This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
//#define cin fin
//#define cout fout
ifstream fin("conexidad.in");
ofstream fout("conexidad.out");
#define int unsigned long long
#define pii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
const int maxNr=2e5, mod = 1e9+7, inf = 2e9;
int n;
struct cv{double x; double r;}a[maxNr+1];
double calc(cv x, cv y)
{
return (x.x-y.x)*(x.x-y.x)/(4*x.r);
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i=1;i<=n;i++)
cin >> a[i].x >> a[i].r;
stack<int>st;
for(int i=1;i<=n;i++)
{
while(!st.empty())
{
double r=min(calc(a[st.top()], a[i]), a[i].r);
a[i].r=r;
if(r>=a[st.top()].r)
{
st.pop();
}
else break;
}
cout << fixed << setprecision(3) << a[i].r << '\n';
st.push(i);
}
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... |