Please explain to me the third condition in the problem statement.
Each Selina only changes her direction (from bouncing to falling or vice versa) when she cannot keep moving in the current direction without leaving the tree or hitting another Selina, that is, when one of the following happens:
- reaching a leaf when falling
- reaching the root when bouncing
- meeting another Selina that's moving in the opposite direction
I understand that this is a problem for live contest and hence, I am not asking you to tell me the solution. I just would like to understand what it means.