Hello Please help me in solving this question.

The contest is over.

I am not able to figure out the approach

Question # 1

How to attempt?

Question :

Annual Day

On the occasion of annual day in school, the principal of the school decides that he will

distribute chocolates to students. The principle orders the students to stand in a queue and

the teachers have four types of chocolates. He wants to distribute chocolates in such a

manner that neighbouring students will not receive the same chocolate.

If ith student receives type-2 chocolate then, (i-1 and (i+1)th will not receive type-2

chocolates. The principle wants to know the minimum money needed to distribute the

chocolate. It is not necessary that chocolates of the same type are equal in price.

Input Specification

input1: Number of students.

input2: A 2-0 array (i x j) with i=input1 and j=4, representing the money

needed for giving j-type of chocolate to ith student.

Output Specification