Hi everyone,
http://acm.sgu.ru/problem.php?contest=0&problem=304
I was solving this problem and I was unable to. I believe that this is DP, but I do not know the state. I do note that, for any gum, we can easily uniquely determine how much it will cost to take n teeth from that gum by picking greedily.
Thanks much in advance, themaskedhero