Search for associated production of charmed particles in π-p collisions at 40 GeV