Submission #868375

#TimeUsernameProblemLanguageResultExecution timeMemory
868375noyancanturkBalloons (CEOI11_bal)C++17
10 / 100
146 ms6628 KiB
#ifndef Local #pragma GCC optimize("O3,unroll-loops") #endif #include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; const int lim=2e5+1; int mod=1e9+7; using pii=pair<int,int>; void solve(){ int n; cin>>n; double x[n],r[n]; for(int i=0;i<n;i++){ cin>>x[i]>>r[i]; } cout<<fixed<<setprecision(3); stack<pair<double,double>>s; for(int i=0;i<n;i++){ auto check=[&]()->bool { double dist=(x[i]-s.top().second),cur=dist*dist/(4*s.top().first); cur=min(cur,r[i]); if(s.top().first<=cur)return 1; return 0; }; while(s.size()&&check()){ s.pop(); } if(!s.size()){ cout<<r[i]<<"\n"; s.push({r[i],x[i]}); continue; } double dist=abs(x[i]-s.top().second),cur=dist*dist/(4*s.top().first); if(r[i]<cur){ cout<<r[i]<<"\n"; s.push({r[i],x[i]}); }else{ cout<<cur<<"\n"; s.push({cur,x[i]}); } } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #ifdef Local freopen(".in","r",stdin); freopen(".out","w",stdout); #else //freopen("dishes.in","r",stdin); //freopen("dishes.out","w",stdout); #endif int t=1; //cin>>t; while (t--) { solve(); } }
#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...