← Home
write a go solution for Description:
The symbol wedge is quite ambiguous, especially when used without context. Sometimes it is used to denote a power (awedgeb=a^b) and sometimes it is used to denote the XOR operation (awedgeb=aoplusb).

You have an ambiguous expression E=A_1wedgeA_2wedgeA_3wedgeldotswedgeA_n. You can replace each wedge symbol with either a textttPower operation or a textttXOR operation to get an unambiguous expression E'.

The value of this expression E' is determined according to the following rules:

- All textttPower operations are performed before any textttXOR operation. In other words, the textttPower operation takes precedence over textttXOR operation. For example, 4;textttXOR;6;textttPower;2=4oplus(6^2)=4oplus36=32.
- Consecutive powers are calculated from left to right. For example, 2;textttPower;3;textttPower;4=(2^3)^4=8^4=4096.

You are given an array B of length n and an integer k. The array A is given by A_i=2^B_i and the expression E is given by E=A_1wedgeA_2wedgeA_3wedgeldotswedgeA_n. You need to find the XOR of the values of all possible unambiguous expressions E' which can be obtained from E and has at least k wedge symbols used as textttXOR operation. Since the answer can be very large, you need to find it modulo 2^2^20. Since this number can also be very large, you need to print its binary representation without leading zeroes. If the answer is equal to 0, print 0.

Input Format:
The first line of input contains two integers n and k (1<=n<=2^20,0<=k<n).

The second line of input contains n integers B_1,B_2,ldots,B_n (1<=B_i<2^20).

Output Format:
Print a single line containing a binary string without leading zeroes denoting the answer to the problem. If the answer is equal to 0, print 0.

Note:
For each of the testcases 1 to 3, A=2^3,2^1,2^2=8,2,4 and E=8wedge2wedge4.

For the first testcase, there is only one possible valid unambiguous expression E'=8oplus2oplus4=14=(1110)_2.

For the second testcase, there are three possible valid unambiguous expressions E':

- 8oplus2oplus4=14
- 8^2oplus4=64oplus4=68
- 8oplus2^4=8oplus16=24

For the third testcase, there are four possible valid unambiguous expressions E':

- 8oplus2oplus4=14
- 8^2oplus4=64oplus4=68
- 8oplus2^4=8oplus16=24
- (8^2)^4=64^4=2^24=16777216

For the fourth testcase, A=2,2 and E=2wedge2. The only possible valid unambiguous expression E'=2oplus2=0=(0)_2.. Output only the code with no comments, explanation, or additional text.