Submission #868378

#TimeUsernameProblemLanguageResultExecution timeMemory
868378noyancanturkBalloons (CEOI11_bal)C++17
20 / 100
162 ms4948 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++){ double cur=r[i]; while(s.size()){ double dist=(x[i]-s.top().second); cur=min(dist*dist/(4*s.top().first),r[i]); if(s.top().first<=cur)s.pop(); else break; } 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...