Scuba Dive

I need to know how i can solve this problem.
I know this can be solved by modifying the basic knapsack problem but i want a complete sort of tutorial for this problem. Because I am not able to implement the knapsack idea. So if anyone could just write a tutorial(a short explanation) about the problem it would be great.

//