Hey, Everyone I am unable to understand that how should I apply knapsack in this problem
http://codeforces.me/problemset/problem/741/B
Because it contains different groups.Thus Mine complexity is coming O(W*N*N).I saw the editorial but unable to understand the solution.Can anyone explain ?