Submission #1063023

# Submission time Handle Problem Language Result Execution time Memory
1063023 2024-08-17T13:24:58 Z enzy Balloons (CEOI11_bal) C++17
100 / 100
346 ms 7044 KB
#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 time Memory Grader output
1 Correct 1 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 508 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 63 ms 604 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 120 ms 1400 KB 50000 numbers
2 Correct 98 ms 2136 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 184 ms 2164 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 188 ms 2488 KB 115362 numbers
2 Correct 252 ms 4432 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 253 ms 3152 KB 154271 numbers
2 Correct 346 ms 6996 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 317 ms 3408 KB 200000 numbers
2 Correct 336 ms 7044 KB 199945 numbers