dynamic programming knapsack

hey please make me understand the logic of the question http://www.codechef.com/NCC2014/problems/EXAM/

Hey, the editorial has been put up here - EXAM - Editorial.

//