Submarine toy problem

Question

Hints

Answer