# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928948 | doducanh | Balloons (CEOI11_bal) | C++14 | 250 ms | 7772 KiB |
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 x first
#define r second
pair<int,int>a[200005];
double ans[200005];
int n;
double cal(pair<double,double>a,double bx)
{
return double((a.x-bx)*(a.x-bx))/(4*a.r);
}
main()
{
cin>>n;
stack<pair<double,double>>s;
for(int i=1;i<=n;i++){
double x,r;
cin>>x>>r;
double maxr=r;
while(s.size()){
double last=cal(s.top(),x);
maxr=min(maxr,last);
if(maxr>=s.top().r){
s.pop();
continue;
}
else break;
}
s.push({x,maxr});
ans[i]=maxr;
}
for(int i=1;i<=n;i++)cout<<fixed<<setprecision(3)<<ans[i]<<"\n";
return 0;
}
Compilation message (stderr)
# | 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... |