#P9365. [ICPC2022 Xi'an R] Power of Two
[ICPC2022 Xi'an R] Power of Two
题目描述
$$2 ^ {2 ^ {2 ^ {2 ^ {2 ^ {2 ^ {2 ^ {2 ^ {2 ^ {2}}}}}}}}} $$SolarPea likes blowing up PolarSea's blog by sending power tower of . As the tower is too high, the stack of the web page overflows. So the blog no longer works.
Now SolarPea has powers of two , bitwise AND operators, bitwise OR operators and bitwise XOR operators. It is guaranteed that .
Solarpea wants to construct an arithmetic expression with these numbers and operators. Formally, define and , where is a permutation of , which means we can rearrange to get , and is one of the three types of bitwise operators above. Then is the result of the expresstion.
The larger the expression, the more likely it is to make PolarSea's blog unable to work. SolarPea wants you to help him to find the largest and construct such an expression. If there are multiple solutions, output any of them.
You need to process test cases independently.
输入格式
The first line contains a single integer (), denoting the number of test cases.
For each test case, the first line contains four integers , , and (). The next line contains integers (), where .
It is guaranteed that the sum of over all test cases is no more than .
输出格式
For each test case, output three lines.
The first line contains a -string of length , representing the binary form of the largest .
The next line contains a single -indexed string of length , where represents the -th operator. Here, we denote AND as &
(ASCII 38), OR as |
(ASCII 124), and XOR as ^
(ASCII 94). You should guarantee that there is exactly AND operators, OR operators and XOR operators.
The third line contains integers , the -th of which representing the logarithm of with base . That is, is a permutaion of .
If there are multiple solutions, output any of them.
4
4 3 0 1
1 0 1 0
4 1 0 3
1 0 1 0
8 0 2 6
1 5 5 7 1 5 5 7
8 0 0 8
1 5 5 7 1 5 5 7
0010
&&^&
0 0 1 1
0011
^^&^
0 1 0 1
10100000
^^|^^^^|
1 5 5 7 1 5 5 7
00000000
^^^^^^^^
1 5 5 7 1 5 5 7
提示
Source: The 2022 ICPC Asia Xi'an Regional Contest Problem H.
Author: Alex_Wei.