Dynamic Programming

Codeforces Round #165 (Div. 1) B. Greenhouse Effect

codeforces.com Because Xi < Xi+1, for i in [1, N). The plants are given in order "from left to the right". So all of Xi values are not important in this problem. We can discard them. Now the problem is: Given N numbers S[N]. Given a number…