An accelerated Monte Carlo method to solve two-dimensional radiative transfer and molecular excitation. With applications to axisymmetric models of star formation