405642: GYM102020 I Illegal Towers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Illegal Towerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There are $$$N$$$ different types of pieces, numbered from $$$1$$$ to $$$N$$$, the $$$i$$$-th of them having length $$$L_{i}$$$ and, for each type, there are exactly $$$10^9$$$ pieces of it. A tower is a sequence of pieces, where the tower's height is the summation of the lengths of the pieces in it.

You just made two new friends: Serra and Beza! They have towers of height $$$A$$$ and $$$B$$$, respectively. If the height of their towers is different, one of them becomes sad. Therefore, in order to help your friends, you decided you're gonna distribute some pieces in such a way that the height of their towers become equal. Show the set of pieces that must be given to each one of them.

Input

The first line of input contain two integers $$$A$$$ and $$$B$$$ $$$(1 \leq A, B \leq 10^{9})$$$, representing the initial height of the towers of Serra and Beza, respectively.

The second line contains an integer $$$N$$$ $$$(1 \leq N \leq 10^{5})$$$, the number of different types of pieces.

The third line contains $$$N$$$ integers $$$L_{i}$$$ $$$(1 \leq L_{i} \leq 10^{4})$$$, where $$$L_{i}$$$ is the length of the pieces of the $$$i$$$-th type.

Output

You must output two blocks of $$$N$$$ lines each. The first line contains the set of pieces given to Serra, and the second line, the set of pieces given to Beza.

The $$$i$$$-th line of the first block must have a single integer $$$a_{i}$$$, denoting the number of pieces of the $$$i$$$-th type you must give to Serra.

The $$$i$$$-th line of the first block must have a single integer $$$b_{i}$$$, denoting the number of pieces of the $$$i$$$-th type you must give to Beza.

Note that the output must obey $$$a_{i} + b_{i} \leq 10^{9}$$$, for all $$$i$$$ $$$(1 \leq i \leq N)$$$.

It is guaranteed that there is always an answer. If there is more than one correct solution, you can output any of them.

ExampleInput
3 8
2
3 4
Output
3
0
0
1

加入题单

上一题 下一题 算法标签: