There are N boxes placed in a row and M diamonds are distributed in these boxes such that each box contains at least 1 diamond into it. Each diamond is of certain colour and has a certain value. Formally, diamond i has colour Ci and value Vi. Each diamond is put in a certain box denoted by Bi. Now your task is to take exactly one diamond from each box such that total value of diamonds taken is maximum and diamonds taken from two consecutive boxes are of different colours. If it is impossible to satisfy the conditions, output -1.code in c++
Answers
Answered by
1
Answer:
sorry I can't understand this question
Similar questions