Discussion for the IOI 2016 problem Detecting Molecules.
I should say "impatience a vice", :( but it's good.
google street view
In this quiz, you'll come across different versions of the Knapsack problem (5 versions, to be specific) and get better at dynamic programming. Expected time to take full quiz: 30-60 minutes. Enjoy!
Not fast enough, you should scan through all i but binary search for each corresponding j.