Problem A
Braaaains
Aha, you may have found a solution to the zombie apocalypse! All zombies want to do is eat brains, so why not synthesize your own?
You have come up with a new recipe for a plant-based brain substitute and have begun mass production. Orders from other strongholds are pouring in.
An infinite supply of shipping containers is available, and each can hold a specific number of brain substitutes. These substitutes are delicate; each container should be perfectly packed in order to ensure the brains do not roll around and get bruised during transportation.
Unfortunately, not every order can be satisfied through an exact packing of containers. While you do have an infinite supply of shipping containers, you do not have access to any packing foam during the zombie apocalypse. Orders that cannot be satisfied by sending perfectly packed shipping containers will incur a small delay while you hunt down packing foam.
For example, if the only sizes of shipping containers you
have access to can hold either
Your task is the following. Given the sizes of shipping containers at your disposal and sizes of various orders for brain substitutes, you should determine which orders can be satisfied at once by perfectly packing shipping containers and which orders will be delayed while you hunt down packing foam.
Input
The first line of input contains two integers
The second line contains
The last line contains
Output
Output a single line containing
Sample Input 1 | Sample Output 1 |
---|---|
2 7 5 4 4 11 12 13 5 8 6 |
1 0 1 1 1 1 0 |
Sample Input 2 | Sample Output 2 |
---|---|
1 10 2 1 2 3 4 5 6 7 8 9 10 |
0 1 0 1 0 1 0 1 0 1 |
Sample Input 3 | Sample Output 3 |
---|---|
5 10 14 21 99 17 14 67 43 101 98909878294 12 41124 1 67 67 9128 |
0 0 1 1 0 1 0 0 0 1 |