Company: opentext_16oct
Difficulty: medium
Product Selection for Maximum Energy Problem Description Tom is performing an experiment in which he has to select N products. Each product has two attributes i.e. energy and weight. All the products are either manufactured by Reds Ltd. or Blues Ltd. The products manufactured by Blues Ltd. cannot function alone and need to be selected with some other product of the same company. The products from Reds Ltd., on the other hand, can be selected independently. Tom has to select products such that the total weight of the selected products does not exceed the weight W and the selected products have the maximum total energy value. Write an algorithm to help Tom find the maximum energy. Input The first line of the input consists of two space-separated integers - N and W, representing the number of products to select and the threshold value of the total weight of N selected products, respectively. The next N lines consist of three space-separated integers - e, m and c, representing the energy,