Impact-induced energy partitioning, melting, and vaporization on terrestrial planets