Submission #941938

#TimeUsernameProblemLanguageResultExecution timeMemory
941938abel2008Balloons (CEOI11_bal)C++14
100 / 100
555 ms5568 KiB
#include <iostream> #include <stack> #include <iomanip> #include <cmath> using namespace std; using ll = long double; ll n,x,r,rez; stack<pair<ll,ll>> S; // pozitia si raza pe care o are int main() { cin>>n; cin>>x>>r; rez+=r; S.emplace(x,r); cout<<fixed<<setprecision(3)<<r<<'\n'; for (int i = 2;i<=n;++i) { cin>>x>>r; ll crtr = r; // verificam limitele de dinainte bool ok = 1; while(ok&&!S.empty()) { // calculam radius maxim fata de cercul de dinainte ll maxr = pow((x-S.top().first),2LL)/(4*S.top().second); crtr = min(crtr,maxr); if (S.top().second<=crtr) { // we can remove it and keep searching ok = 1; S.pop(); } else { // ok = 0; } } S.emplace(x,crtr); rez+=crtr; cout<<fixed<<setprecision(3)<<crtr<<'\n'; } // cout<<rez; 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...