Finally we reached at the end of round 2. And today can be a big day for you as today’s problem may fetch you a maximum of 300 points. So, here’s your problem statement which is digressing from the trend of previous phase.
Problem Statement: Suppose you are a thief and you have broken into a Richie Rich’s house. You have a carry bag with you that can take up to M units of weight. The house is having N different riches having different profit values and weights. Your task is to fill your carry bag in such a way so that you can earn maximum profit. Either an item can be picked completely or totally rejected, that is, you can’t pick up fraction of an item.
You need to take input as N(different items available), Pi (their corresponding profit values), Wi (their corresponding weights) and M (capacity of your carry bag). And then you need to give output maximum profit that can be earned.
Samples:
Test case-I
Input: N=4 M=20 Pi={2,3,3,2} Wi={5,7,3,10}
Output: Maximum Profit=8
Hint: Because we are taking items 1,2,3 and rejecting just item 4.
Test case-II
Input: N=6 M=30 Pi={3,8,4,3,20,6} Wi={3,5,2,6,10,4}
Output: Maximum Profit=44
Test case-III
Input: N=4 M=25 Pi={8,9,10,11} Wi={4,8,6,6}
Output: Maximum Profit=38
You can't pickup more than the capacity of carry bag as in case-I
Test case-I
Input: N=4 M=20 Pi={2,3,3,2} Wi={5,7,3,10}
Output: Maximum Profit=8
Hint: Because we are taking items 1,2,3 and rejecting just item 4.
Test case-II
Input: N=6 M=30 Pi={3,8,4,3,20,6} Wi={3,5,2,6,10,4}
Output: Maximum Profit=44
Test case-III
Input: N=4 M=25 Pi={8,9,10,11} Wi={4,8,6,6}
Output: Maximum Profit=38
You can't pickup more than the capacity of carry bag as in case-I
BEST OF LUCK




