{"problem":{"name":"I. Illegal Towers","description":{"content":"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, wh","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10202I"},"statements":[{"statement_type":"Markdown","content":"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.\n\nYou 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.\n\nThe first line of input contain two integers $A$ and $B$ $(1 <= A, B <= 10^9)$, representing the initial height of the towers of Serra and Beza, respectively.\n\nThe second line contains an integer $N$ $(1 <= N <= 10^5)$, the number of different types of pieces.\n\nThe third line contains $N$ integers $L_i$ $(1 <= L_i <= 10^4)$, where $L_i$ is the length of the pieces of the $i$-th type.\n\nYou 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.\n\nThe $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.\n\nThe $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.\n\nNote that the output must obey $a_i + b_i <= 10^9$, for all $i$ $(1 <= i <= N)$.\n\nIt is guaranteed that there is always an answer. If there is more than one correct solution, you can output any of them.\n\n## Input\n\nThe first line of input contain two integers $A$ and $B$ $(1 <= A, B <= 10^9)$, representing the initial height of the towers of Serra and Beza, respectively.The second line contains an integer $N$ $(1 <= N <= 10^5)$, the number of different types of pieces.The third line contains $N$ integers $L_i$ $(1 <= L_i <= 10^4)$, where $L_i$ is the length of the pieces of the $i$-th type.\n\n## Output\n\nYou 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 <= 10^9$, for all $i$ $(1 <= i <= N)$.It is guaranteed that there is always an answer. If there is more than one correct solution, you can output any of them.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ A, B \\in \\mathbb{Z}^+ $ be the initial heights of Serra’s and Beza’s towers.  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of piece types.  \nLet $ L = (L_1, L_2, \\dots, L_N) \\in \\mathbb{Z}^N $ be the lengths of the piece types.  \nLet $ a = (a_1, a_2, \\dots, a_N) \\in \\mathbb{Z}_{\\geq 0}^N $ be the number of pieces of each type given to Serra.  \nLet $ b = (b_1, b_2, \\dots, b_N) \\in \\mathbb{Z}_{\\geq 0}^N $ be the number of pieces of each type given to Beza.  \n\n**Constraints**  \n1. $ 1 \\le A, B \\le 10^9 $  \n2. $ 1 \\le N \\le 10^5 $  \n3. $ 1 \\le L_i \\le 10^4 $ for all $ i \\in \\{1, \\dots, N\\} $  \n4. $ a_i + b_i \\le 10^9 $ for all $ i \\in \\{1, \\dots, N\\} $  \n\n**Objective**  \nFind $ a, b $ such that:  \n$$\nA + \\sum_{i=1}^N a_i L_i = B + \\sum_{i=1}^N b_i L_i\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10202I","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}