I wonder how it is possible to solve this task....
Because DP will need too much memory (1,000,000) litres = (1,000,000,000) mililitres and it is too much.
And I wonder if there is any good algoritm that can solve this task fast ..
Thanks in advance
![:)](./images/smilies/icon_smile.gif)
Moderator: Board moderators
After reading the input description, I have a feeling that the information bolded above may help us to deal with large cases. (Notice the great difference between 1,000,000,000mL[max. vol. of wine] and 4500mL[max. capacity of a bottle])The first line of input contains two integers: the amount of wine to be bottled (in litres, between 0 and 1,000,000) and the number of sizes of bottles (between 1 and 100). For each size of bottle, one line of input follows giving the minimum and maximum capacity of each bottle in millilitres. The maximum capacity is not less than 325 ml and does not exceed 4500 ml. The minimum capacity is not less than 95% and not greater than 99% of the maximum capacity. You may assume that an unlimited number of each bottle is available.
This gave me idea of dealing with large cases.little joey wrote:Say, you have a bottle that can contain a minimum of 950 ml and a maximum of 1000 ml.
What are the minimum and maximum amounts you can store in 2 bottles? And in 19 bottles? And 20?
Do you notice something when looking at the numbers?
This gives constraints of large cases.The maximum capacity is not less than 325 ml and does not exceed 4500 ml. The minimum capacity is not less than 95% and not greater than 99% of the maximum capacity.