Earned EXP and EVs go to all party Pokémon, those who didn't participate in the battle gain 50% of it.