I forgot an important constraint to my question - that both cyclists reach the top simultaneously.
Given that constraint, I'd guess both exert the same power (both output the same work over the same time).
Where I get hung up though, is that the cyclist who is mashing the pedals would be exerting more force over the same distance compared to the cyclist who is spinning faster. I suppose the force by the spinner is greater than I perceive given the greater number of repetitions.
Anecdotally, mashing on a high geared singlespeed is tougher, but I suppose it's all how you train you legs.