# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495906 | keertan | Balloons (CEOI11_bal) | C++17 | 199 ms | 4924 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 int int64_t
#define all(x) x.begin(), x.end()
#define all1(x) x.rbegin(), x.rend()
#define sz(x) (int)(x.size())
const int N = 1e5 + 5, mod = 1e9 + 7;
const int64_t N1=1e18;
const double eps=1e-11;
//#define double long double
void solve(){
int n;
cin>>n;
vector<pair<double,double>> z(n);
for (pair<double,double> &it:z){cin>>it.first>>it.second;}
stack<pair<double,double>> s;
for (int i=0;i<n;i++){
bool chk=1;
while(1){
if (s.empty()){
s.emplace(z[i].first,z[i].second);
break;
}
else{
double x=z[i].first,y=z[i].second,x1=s.top().first,y1=s.top().second;
double r=1.0*(1.0*(x1-x)*(x1-x))/(4.0*y1);
if (chk){z[i].second=min(r,z[i].second);r=z[i].second;chk=0;}
if (r>=y1){s.pop();}
else{
s.emplace(z[i].first,z[i].second);
break;
}
}
}
cout<<fixed<<setprecision(3)<<s.top().second<<"\n";
}
}
int32_t main(){
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
int tq = 1;
//cin>>tq;
for (;tq;tq--){solve();}
}
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... |