# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
863851 | Abito | Balloons (CEOI11_bal) | C++17 | 222 ms | 23120 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>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=2e5+5;
double a[N],x[N],R[N];
int n;
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=n;i++) cin>>x[i]>>a[i];
set<pair<double,int>> s;
R[1]=a[1];
s.ep({4*R[1]+x[1],1});
for (int i=2;i<=n;i++){
double l=0,r=a[i],mid,ans;
int j=(*--s.end()).S;
for (int hhh=0;hhh<50;hhh++){
mid=(l+r)/2;
bool ok=((x[i]-x[j])*(x[i]-x[j])>=4*mid*R[j] || (x[i]-x[1])*(x[i]-x[1])>=4*mid*R[1]);
if (ok){
ans=mid;
l=mid;
}else r=mid;
}R[i]=ans;
s.ep({R[i]+x[i],i});
}for (int i=1;i<=n;i++) cout<<fixed<<setprecision(9)<<R[i]<<endl;
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... |