Submission #435298

#TimeUsernameProblemLanguageResultExecution timeMemory
435298harshith828Balloons (CEOI11_bal)C++14
20 / 100
206 ms8364 KiB
#include <bits/stdc++.h> #include <iomanip> using namespace std; long double get_min(long double x1,long double x2){ if(x1 > x2){ return x2; } return x1; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); long long int n; cin >> n; stack<pair<long long int,double>> s; long long int x,r; vector<long double> v; for(int i = 0;i < n;i++){ cin >> x >> r; long double radius = r; //cout << x << " " << r << "\n"; while(!s.empty() and (s.top()).first + (s.top()).second >= x - r ){ // cout << radius << " "; radius = get_min((((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),radius); //cout << (((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)) << " " << r << " " << s.top().second << "\n"; radius = get_min(radius,r); if(radius > s.top().second){ s.pop(); } else{ break; } } // cout <<"\n"; v.push_back(radius); s.push(make_pair(x,radius)); } for(int i = 0;i < n;i++){ if(i != n - 1){ cout << fixed << setprecision(6) << v[i] << "\n"; } else{ cout << fixed << setprecision(6) << v[i]; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...