In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
The candy shop owned by Byteasar sells delicious caramel candy. For every positive integer there is exactly one package that contains candies; currently no new deliveries are expected. To encourage customers to buy the sweets, Byteasar has planted vouchers for an annual supply of chocolate into some packages, making sure to put at most one voucher in each package.
The carnival starts next week in Byteburg, and it will last days; on the -th day of the carnival a party with guests will be held. Byteasar is confident that on the -th day's morning each of those guests is going to buy, in his own store, the smallest package of candy available whose content can be equally distributed between the party guests. For example, if , , , then on the first day of the carnival he expects to sell the packages containing four, eight, twelve, and sixteen candies, selling those with two and six candies on the second day.
Now he is wondering which customers will end up with the packages holding the vouchers. He has asked you to write a program that will determine this for him.
On the first line of the standard input there is a single integer () that denotes the number of vouchers. The -th of the lines that follow holds an integer () denoting the size (i.e., the number of candies inside) of a package in which Byteasar has placed the -th voucher. These numbers are given in an increasing order.
Then the next line contains a single integer () that denotes the number of carnival days. The -th of the lines that follow holds an integer () denoting the number of guests attending the -th party.
You may assume that in tests worth at least 50% of the total points none of the numbers given on the input exceeds .
In the first line of the standard output your program should print an integer - the number of packages with vouchers sold. The following lines should specify the numbers of those customers who bought a package with a voucher, in an increasing order. The customers are numbered from in the order of their purchases.
For the input data:
4 1 6 8 16 3 4 2 4
the correct result is:
3 2 4 6
Task author: Jakub Pachocki.