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 int long long
#define double long double
const int N=2e5+1, pi=3.14;
int n;
struct dt{
double x,r;
};
double Ri(dt b, dt c){
return (b.x-c.x)*(b.x-c.x)/(4*c.r);
}
double area(dt b){
return b.r*b.r*3.14;
}
dt a[N+10];
deque<dt> q;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for (int i=1;i<=n;i++)
cin>>a[i].x>>a[i].r;
for (int i=1;i<=n;i++){
double R = a[i].r;
if (!q.empty()){
R = min(R,(Ri(a[i],q.front())));
if (R!=a[i].r){
while(!q.empty() && R>=q.front().r){
q.pop_front(),R=min(R,(Ri(a[i],q.front())));
}
}
}
q.push_back({a[i].x,R});
if (R != a[i].r) R-=0.000000001;
cout <<fixed<<setprecision(9)<<R<<endl;
}
}
# | 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... |