{"raw_statement":[{"iden":"statement","content":"A bitwise XOR takes two bit patterns of equal length and performs the logical exclusive OR operation on each pair of corresponding bits. The result in each position is $1$ if both bits are different (only one of them is $1$ and the other is $0$), but will be $0$ if both bits are the same (both are $0$ or both are $1$). For example, the bitwise XOR of the patterns $0101$ and $1100$ is $1001$.\n\nIn this problem, you are given $3$ binary strings of lengths $10$ digits such that all digits are either $0$ or $1$. You can swap any two digits in the same string infinitely, but you cannot swap two digits from two different strings.\n\nYour task is to rearrange digits in the given strings in a way such that the bitwise XOR of the strings after rearranging their digits is as largest as possible. Can you?\n\nThe first line contains an integer $T$ ($1 <= T <= 250$) specifying the number of test cases.\n\nEach test case consists of $3$ lines each of which contains a binary string of length $10$ digits such that all digits are either $0$ or $1$. \n\nFor each test, print a single line containing a binary string of length $10$ representing the largest value of bitwise XOR that can be optioned by rearranging digits in each string.\n\nA binary string $x$ is larger than a binary string $y$ if after converting both strings to the decimal representation, the decimal value of string $x$ is larger than the decimal value of string $y$. For example, string \"_1100_\" is larger than string \"_0101_\" because its decimal value $12$, while the decimal value of string \"_0101_\" is $5$.\n\nIn the first test case, you can rearrange the given strings as follow: \n\n"},{"iden":"input","content":"The first line contains an integer $T$ ($1 <= T <= 250$) specifying the number of test cases.Each test case consists of $3$ lines each of which contains a binary string of length $10$ digits such that all digits are either $0$ or $1$. "},{"iden":"output","content":"For each test, print a single line containing a binary string of length $10$ representing the largest value of bitwise XOR that can be optioned by rearranging digits in each string.A binary string $x$ is larger than a binary string $y$ if after converting both strings to the decimal representation, the decimal value of string $x$ is larger than the decimal value of string $y$. For example, string \"_1100_\" is larger than string \"_0101_\" because its decimal value $12$, while the decimal value of string \"_0101_\" is $5$."},{"iden":"note","content":"In the first test case, you can rearrange the given strings as follow:   \"_0000101011_\" $arrow.r$ \"_0000111100_\"  \"_0001010101_\" $arrow.r$ \"_1111000000_\"  \"_0010010000_\" $arrow.r$ \"_0000000011_\" "}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of robots.  \nLet $ A = (a_1, a_2, \\dots, a_n) \\in (\\mathbb{Z}^+)^n $, where $ a_i $ is the time robot $ i $ needs to cover the distance after receiving the signal.  \nLet $ S \\subseteq \\{1, 2, \\dots, n\\} $ be a non-empty subset of active signal devices.  \nFor each robot $ i $, define $ x_i(S) = \\min_{j \\in S} |i - j| $, the distance to the nearest active device.  \nThe finish time of robot $ i $ under $ S $ is $ f_i(S) = x_i(S) + a_i $.  \n\nLet $ k_i(S) = \\left| \\{ j \\neq i \\mid f_j(S) < f_i(S) \\} \\right| $.  \nThe rank (place) of robot $ i $ under $ S $ is $ r_i(S) = k_i(S) + 1 $.  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 400{,}000 $  \n2. $ 1 \\leq a_i \\leq 10^9 $  \n3. $ S \\neq \\emptyset $  \n\n**Objective**  \nGiven $ p \\in \\{1, 2\\} $:  \n- If $ p = 1 $, compute for each $ i \\in \\{1, \\dots, n\\} $:  \n  $$\n  \\min_{\\substack{S \\subseteq \\{1,\\dots,n\\} \\\\ S \\neq \\emptyset}} r_i(S)\n  $$  \n- If $ p = 2 $, compute for each $ i \\in \\{1, \\dots, n\\} $:  \n  $$\n  \\max_{\\substack{S \\subseteq \\{1,\\dots,n\\} \\\\ S \\neq \\emptyset}} r_i(S)\n  $$","simple_statement":"You are given n robots on n tracks. Robot i takes ai seconds to finish after it starts.  \nA signal starts from active devices (at least one must be active). The signal travels 1 meter per second between adjacent tracks.  \nRobot i starts when the signal reaches its track — so if the closest active device is d tracks away, it starts after d seconds.  \nRobot i finishes at time fi = d + ai.  \nPlace of robot i = 1 + number of robots that finished strictly before it.  \nIf multiple robots finish at same time, they share the same place.  \n\nYou must answer:  \n- If p=1: For each robot, what’s the BEST (minimum) place it can get?  \n- If p=2: For each robot, what’s the WORST (maximum) place it can get?  \n\nChoose which devices to turn on/off (at least one on) to optimize the place for each robot.","has_page_source":false}