Submission #938839

#TimeUsernameProblemLanguageResultExecution timeMemory
938839mnbvcxz123Balloons (CEOI11_bal)C++17
100 / 100
117 ms11808 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int M=998244353; void solve(){ int x; cin>>x; pair<int, int> arr[x]; long double ans[x]; for(int i=0; i<x; i++){ cin>>arr[i].first>>arr[i].second; } stack<pair<int, long double>> s; for(int i=0; i<x; i++){ long double r=arr[i].second; while(!s.empty()){ r=min(r, (arr[i].first-s.top().first)*(arr[i].first-s.top().first)/(4*s.top().second)); if(r>=s.top().second) s.pop(); else break; } ans[i]=r; s.push({arr[i].first, ans[i]}); } for(int i=0; i<x; i++) cout<<fixed<<setprecision(3)<<ans[i]<<'\n'; } signed main(){ //freopen("in", "r", stdin); //freopen("out", "w", stdout); cin.tie(0)->sync_with_stdio(0); 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...