Company: Barclays_27july
Difficulty: medium
Reactor Energy Maximization Problem Description Dr. Victor Frankenstein has left the monster business behind and now builds fission reactors. His latest reactor holds at most maxCapacity gallons of liquid. He owns N vials of radioactive liquid; pouring vial i into the reactor adds vol[i] gallons of volume and mass[i] units of mass to it, and produces energy[i] units of energy. There is a catch. If the combined mass of the liquids inside the reactor ever exceeds criticalMass , the reaction runs away and the reactor explodes. Victor therefore wants to choose a set of vials whose total volume is at most maxCapacity and whose total mass is at most criticalMass , so that the total energy produced is as large as possible. Each vial is poured whole or not at all, and each vial may be poured at most once. Input Format Line 1: an integer maxCapacity , the capacity of the reactor. Line 2: an integer criticalMass , the critical mass of the reactor. Line 3: an integer numVolumes , the number of li