Company: opentext_16oct
Difficulty: medium
Product Selection Problem Description Priya is running a warehouse-loading experiment where she must pick N items to load. Each item has two attributes: energy and weight. Every item is manufactured by either Reds Ltd. or Blues Ltd. Items from Blues Ltd. cannot be loaded on their own — each one requires at least one other Blues Ltd. item to also be picked. Items from Reds Ltd. carry no such restriction and may be picked on their own. Priya must choose items so that their combined weight stays within the limit W while their combined energy is as large as possible. Devise an algorithm that finds this maximum achievable 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, weight and the manufacturing company marked as 0 or 1 (