In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
The Byteotian Bit Bank (BBB) has the largest network of cash dispensers in the whole Byteotia. The BBB have decided to improve their dispensers and have asked you for help. The legal tender in Byteotia are bank notes of denominations . The BBB have concluded that the cash dispensers are to pay every sum in the smallest possible total number of notes.
Write a programme that:
In the first line of the standard input the number of denominations is written , . The second line contains integers , , separated by single spaces. The third line contains integers , , also separated by single spaces; is the number of banknotes of denomination left in the cash dispenser. In the last, fourth line of input there is one integer - the sum to be paid off, . For the test data, you are free to assume that the sum can be paid off in the available banknotes.
The first line of the standard output should contain one integer denoting the minimal total number of bank notes sufficient to pay the sum off . The second line should contain integers, separated by single spaces, denoting the numbers of notes of subsequent denominations used to pay off the sum . If there are many solutions your programme should write any of them.
For the input data:
3 2 3 5 2 2 1 10
the correct result is:
3 1 1 1
Task author: Bartosz Walczak.