Submission #768361

#TimeUsernameProblemLanguageResultExecution timeMemory
768361vjudge1Balloons (CEOI11_bal)C++17
10 / 100
401 ms18676 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; if (!q.empty()){ R = min(R,(Ri(a[i],q.front()))); if (R!=a[i].r){ while(!q.empty() && R>=q.front().r){ q.pop_front(),R=min(R,(Ri(a[i],q.front()))); } } } 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...