Hi,
firstly, it's not a ramp, but more of a pulley system. Following that,
h = 0 is because when P hits the ground (and does not rebound), there is no more tension in the string.
This means that now the only forces acting on Q is gravitational force, ie g.
When Q goes up at this moment, maybe x m off the ground, the string becomes loose, but when it comes down, and is less than x m off the ground, the string will become taut again.
So h = 0, for the string to become taut again, ie, Q is at the same height from the ground, but this time going downwards.
Using s = ut + 1/2 at^2 , taking upwards accel as positive
0 = t (u -1/2at)
hence t = 0 , or t = 2u/a
The two solutions simply correspond to the time taken. t = 0 is at the start, h = 0, as Q starts to go upwards with a loose string.
t = 2u / a is at the end point, when h = 0 as Q goes downwards, string becomes taut.
Hope this helps, and isn't too confusing.