Codechef MNMX Problem with different constraints

Revision en2, by jaswanthi, 2016-02-25 14:49:26

While the Codechef MNMX problem is easy, I am trying to solve it by changing the constraint to following.

Select a pair of adjacent integers and remove the **smaller** one and keeping the larger one. And the cost is larger one( while the original problem removes the **larger** one) 

In original problem, We are removing the larger one and keeping the smaller one, so We can start with smaller one and do it n-1 times. So the sum_of_cost = (n-1) * min_element

How to solve it if we change the constraint to remove smaller one and keep larger one, and the cost is the larger one ?

Tags array, codechef, adhoc

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English jaswanthi 2016-02-25 14:49:26 58
en1 English jaswanthi 2016-02-25 14:24:24 652 Initial revision (published)