Submission #768197

#TimeUsernameProblemLanguageResultExecution timeMemory
768197vjudge1Balloons (CEOI11_bal)C++17
100 / 100
436 ms12872 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double const int N=2e5, pi=3.14; int n; struct dt{ double x,r; }; double Ri(dt b, dt c){ return (b.x-c.x)*(b.x-c.x)/(4*c.r); } double area(dt b){ return b.r*b.r*3.14; } dt a[N+10]; deque<dt> q; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for (int i=1;i<=n;i++) cin>>a[i].x>>a[i].r; for (int i=1;i<=n;i++){ double R = a[i].r; while(!q.empty()){ R = min(R,Ri(a[i],q.back())); if (R<q.back().r) break; else q.pop_back(); } q.push_back({a[i].x,R}); if (R != a[i].r) R-=0.000000001; cout <<fixed<<setprecision(9)<<R<<endl; } }
#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...