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.
Byteasar runs a bricks and mortar warehouse store. This season's best seller, which accounts for majority of the store's revenue, is the laminate flooring. Unfortunately, it happens quite often that a customer makes an order that cannot be fulfilled, because there are not enough planks in the warehouse. To prevent losing customers, Byteasar has decided to minimize the number of such events.
To this end he has come up with a work schedule for the following days. He has analyzed the contracts with the floors' producers and based on those he has determined a sequence . The number denotes that packages of planks are going to delivered to the warehouse in the morning of the -th day.
Byteasar has also made a sheet of orders made by wholesalers, and based on those has determined another sequence . The number denotes that at noon of the -th day a customer is going to make an order for packages of planks. If Byteasar decides to fulfill the customer's order, he will have to supply him with this many packages. If there are not enough packages in the warehouse when the order is made, Byteasar has to deny the order. If, on the other hand, there is a sufficient number of packages, Byteasar can decide whether he is going to accept the order or not.
Based on these data, Byteasar wants to determine which orders he should accept so that the total number of orders he denies (by choice or by necessity) is minimized. We assume that initially, in the early morning of the first day, the warehouse is empty.
In the first line of the standard input there is an integer (). In the second line there is a sequence of integers (). In the third line there is a sequence of integers (). The numbers in the second and third line are separated by single spaces.
In tests worth 50% of the points the condition holds in addition.
In the first line of the standard output your program should print an integer denoting the maximum number of orders that Byteasar can accept. In the second line an increasing sequence of numbers should be printed, separated by single spaces. Those should be the numbers of customers whose orders should be accepted to that end. If no order can be accepted, the second line should be empty. The customers are numbered from to according to when they make their orders. If there is more than one correct answer, your program should pick one arbitrarily.
For the input data:
6 2 2 1 2 1 0 1 2 2 3 4 4
one of the correct answers is:
3 1 2 4
Task author: Tomasz Idziaszek.