I am considering a situation where two identical masses are side by side and slide down a hill, ignoring friction. But one mass dips into a trench and comes back up, while the other one simply finishes rolling down the hill and continues at constant velocity. I would like to know which ball first passes a "finish line" somewhere after the trench. I drew a crude diagram to explain:
The way I tried to solve was to assume they have the same speed right before and after the trench, therefore they won't pass each other after the trench, so the one that is ahead once they both are past the trench is automatically the winner. Then I tried to figure out if the added velocity for the mass in the trench is enough to overcome the added distance for travelling in the trench. But I am stuck because I don't know how to formulate this properly mathematically. I considered a special case for the trench being a triangle (ignoring any speed loss from impacting a sharp corner) but the result I came up with is that the winner seems to depend on both the depth of the trench and the height fallen before the trench, which seems wrong to me.
My main question is how to conceptually figure out which mass will win the race? As a secondary question to show mathematically whether or not it depends on the heights, shape of the trench, etc.