  We study the charmed meson and baryon production and elliptic flow in
ultra-relativistic nucleus-nucleus collisions at the LHC energies. The
space-time evolution of quark-gluon plasma (QGP) produced in these energetic
collisions is obtained via the (3+1)-dimensional CLVisc hydrodynamics model,
the heavy quark dynamics inside the QGP is simulated using an improved Langevin
model that incorporates both elastic and inelastic parton energy loss
processes, and the heavy quark hadronization is simulated utilizing a
comprehensive coalescence-fragmentation model. Using our combined approach, we
first calculate charmed hadron ratios, $\Lambda_c/D^0$ and $D_s/D^0$, as well
as their elliptic flow ($v_2$) as a function of transverse momentum ($p_T$) for
different centralities in Pb+Pb collisions at $\sqrt{s_{NN}}=5.02$~TeV. Due to
strangeness enhancement and parton coalescence effects, $D_s/D^0$ and
$\Lambda_c/D^0$ ratios increase from peripheral to central collisions, and such
centrality dependence for $\Lambda_c/D^0$ is stronger than $D_s/D^0$. We
further predict the $p_T$ and centrality dependences of charmed hadron
chemistry and $v_2$ in smaller Xe+Xe, Ar+Ar and O+O collisions at the LHC
energies. Strong centrality and system size dependences for $\Lambda_c/D^0$ and
$D_s/D^0$ ratios are observed across four collision systems. As for charmed
hadron flow, both system size and collision geometry are important to
understand the centrality dependence of $v_2$ in different collision systems.
Our study provides a significant reference for studying heavy quark evolution
and hadronizaiton in large and small systems in relativistic nuclear
collisions.
