Submission #845846

#TimeUsernameProblemLanguageResultExecution timeMemory
845846BidoTeimaBalloons (CEOI11_bal)C++17
100 / 100
152 ms5500 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; ld get_rad(ld x1, ld r1, ld x2){ return (x2 - x1) * (x2 - x1) / (4 * r1); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; stack<pair<int,ld>>st; for(int i = 0; i < n; i++){ int x2; ld r; cin>>x2>>r; while(st.size()){ int x1 = st.top().first; ld r1 = st.top().second; r=min(r,get_rad(x1,r1,x2)); if(r>=r1)st.pop(); else{ cout<<fixed<<setprecision(3)<<r<<'\n'; st.push({x2,r}); break; } } if(st.empty()){ cout<<fixed<<setprecision(3)<<r<<'\n'; st.push({x2,r}); } } return 0; }
#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...