I look at it this way, there is a third option. as we are not told when we must throw the switch the tracks, we wait to do so when the trolley will be at the intersection. Thus the sudden change will partially or fully derail the trolley killing neither the 5 nor the single.