Codechef MNMX Problem with different constraints

Правка en1, от jaswanthi, 2016-02-25 14:24:24

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. ( 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 ?

Теги array, codechef, adhoc

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский jaswanthi 2016-02-25 14:49:26 58
en1 Английский jaswanthi 2016-02-25 14:24:24 652 Initial revision (published)