Final-state interactions, resonances and CP violation in D and B exclusive decays