Bincent's Billows

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem type
WCIPEG 2018 ECOO Qualifier

For a living, Bincent runs a company which produces snacks. One of his most popular products are Billows™, for which he constantly receives custom orders.

Usually, the accountants he employs around the country are responsible for processing custom orders. However, the Accountants' Committee for Safe Labour (ACSL) has initiated a country-wide strike. As a result, Bincent must personally review the orders placed to each factory, and calculate the amount of material that each factory requires to complete all orders.

Conveniently, each size is defined by the amount of material required. Can you help Bincent find the amount of material required at each factory?

Input Specification

The first line of input contains a single integer, F, the number of factories.

Each of the F factories will be described by 3 lines of input.
The first line will contain an integer N, the number of different sizes produced at the factory.
The second line wil contain the space separated integers a_1, a_2, \dots, a_n, each representing a different size.
The third line will contain the space separated integers b_1, b_2, \dots, b_n, where b_i represents the number of orders for size a_i.

All integers provided as input will be between 0 and 10\,000, inclusive.

Output Specification

The output should have F integers on separate lines, each integer representing the amount of material which must be transported to each factory.

Sample Input

1 2 5
5 2 0
1 10 100 1000 10000
1 3 7 1 9

Sample Output



  • 0
    ayay9  commented on April 20, 2021, 7:55 p.m.

    This one is really interesting because the sizes are inputted all at once, and then the number of orders, so you have to pair the right ones up and stuff