Find a strategy to evade hungry lions on the real line for the longest time
Assume you start at zero. Lion #i is at $d_i$ and wakes up at $w_i$. If there is no lion with $d_i &gt; 0$ and $w_i &lt; d_i$ then you walk to the right and are safe. If there is no lion with $d_i &lt; 0$ and $w_i &lt; |d_i|$ then you walk to the left and are safe. 

Otherwise, you die. There is always an optimal strategy of the form "move to some point X and stop, then wait until lions force you to move, and die when two lions from either side meet" - the point X is obviously not known. The point X is limited; if for example $d_i &gt; 0$ and $w_i &lt; d_i$ then you can walk only $(d_i + w_i)/2$ before you are forced back. 

Just check the points X that are just before a sleeping lion, or just before one of the two points where you are forced back. For each of these points X, calculate at which time you will die, and pick the best one.

(To make this easier to visualise: If all lions wake up at the same time, and you can't escape, then you want to be within the largest gap between two lions that you can reach, at the moment they wake up. So the point to move to could be anywhere, depending on where the lions are).