Excitation of medium nuclei in the continuum region in inelastic scattering of deuterons