subject

Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however, each person can only take one of each type of item. For example, one family member can take one television, one watch, and one toaster, while another family member can take one television, one camera, and one pair of shoes. Each item has a price (in dollars) and a weight (in pounds) and each person in the family has a limit in the total weight they can carry. Two people cannot work together to carry an item.
Your job is to help the families select items for each person to carry to maximize the total price of all items the family takes. Write an algorithm to determine the maximum total price of items for each family and the items that each family member should select.
Implement your algorithm by writing a program named shopping that follows the specifications below:

Input:
The input file named "shopping. txt" consists of T test cases
T(1 <= T <= 100) is given on the first line of the input file.
Each test case begins with a line containing a single integer number N that indicates the number of items (1 <= N <= 100) in that test case.
Followed by N lines, each containing two integers: P and W. The first integer (1 <= P <= 5000) corresponds to the price of the object and the second integer (1 <= W <= 100) corresponds to the weight of the object.
The next line contains one integer (1 <= F <= 100) which is the number of people in that family.
The next F lines contains the maximum weight (1 <= M <= 200) that can be carried by the i^th person in the family (1 <= i <= F).

Output:
Written to a filed named "shopping. out". For each test case your program should output the maximum total price of all goods that the family can carry out during their shopping spree and for each family member, numbered 1 <= i <= F, list the item numbers 1 <= N <= 100 that they should select.
shopping. txt
4
2
77 7
66 6
2
5
5
6
32 16
43 12
26 4
50 8
20 3
27 9
4
25
23
21
19
5
1 1
2 1
3 1
2 2
5 5
10
1
2
3
4
5
6
7
8
9
10
10
1 1
4 3
4 3
4 4
5 4
8 6
10 7
9 7
11 8
13 9
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
In my email i got a message it says a quick message and in message details on who its from its says nicole and under nicole is [email protected] -
Answers: 1
question
Computers and Technology, 23.06.2019 02:50
There’s only one game mode that stars with the letter ‘e’ in cs: go. which of the options below is it?
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
You know the right answer?
Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family win...
Questions
question
Computers and Technology, 25.09.2020 09:01
question
Mathematics, 25.09.2020 09:01
question
Mathematics, 25.09.2020 09:01
Questions on the website: 13722361