Submission #1063023

#TimeUsernameProblemLanguageResultExecution timeMemory
1063023enzyBalloons (CEOI11_bal)C++17
100 / 100
346 ms7044 KiB
#include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int v[maxn], r[maxn]; int main() { //freopen("art2.in", "r", stdin); //freopen("art2.out", "w", stdout); //OBS: se eu parei por causa de um balao com id y e meu id eh x, posso ignorar todos os baloes de id entre y e x //OBS: se eu tenho uma altura menor que o proximo cara eu posso ser ignorado //pensar: como eu consigo calcular a primeira intersecção? (dado um numero limitado de caras) ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for(int i=1;i<=n;i++) cin >> v[i] >> r[i]; stack<pair<long double,long double>>st; for(int i=1;i<=n;i++){ long double xat=v[i], resp=r[i]; while(!st.empty()){ auto p=st.top(); long double xk=p.first, rk=p.second; long double rat=((xk-xat)*(xk-xat))/(4*rk); resp=min(resp,rat); if(resp<rk) break; else st.pop(); } cout << fixed << setprecision(3) << resp << endl; st.push({xat,resp}); } 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...