CF1673E.Power or XOR?

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The symbol \wedge is quite ambiguous, especially when used without context. Sometimes it is used to denote a power ( ab=aba\wedge b = a^b ) and sometimes it is used to denote the XOR operation ( ab=aba\wedge b=a\oplus b ).

You have an ambiguous expression E=A1A2A3AnE=A_1\wedge A_2\wedge A_3\wedge\ldots\wedge A_n . You can replace each \wedge symbol with either a Power\texttt{Power} operation or a XOR\texttt{XOR} operation to get an unambiguous expression EE' .

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

  • All Power\texttt{Power} operations are performed before any XOR\texttt{XOR} operation. In other words, the Power\texttt{Power} operation takes precedence over XOR\texttt{XOR} operation. For example, 4  XOR  6  Power  2=4(62)=436=324\;\texttt{XOR}\;6\;\texttt{Power}\;2=4\oplus (6^2)=4\oplus 36=32 .
  • Consecutive powers are calculated from left to right. For example, 2  Power  3  Power  4=(23)4=84=40962\;\texttt{Power}\;3 \;\texttt{Power}\;4 = (2^3)^4 = 8^4 = 4096 .

You are given an array BB of length nn and an integer kk . The array AA is given by Ai=2BiA_i=2^{B_i} and the expression EE is given by E=A1A2A3AnE=A_1\wedge A_2\wedge A_3\wedge\ldots\wedge A_n . You need to find the XOR of the values of all possible unambiguous expressions EE' which can be obtained from EE and has at least kk \wedge symbols used as XOR\texttt{XOR} operation. Since the answer can be very large, you need to find it modulo 22202^{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 00 , print 00 .

输入格式

The first line of input contains two integers nn and kk (1n220,0k<n)(1\leq n\leq 2^{20}, 0\leq k < n) .

The second line of input contains nn integers B1,B2,,BnB_1,B_2,\ldots,B_n (1Bi<220)(1\leq B_i < 2^{20}) .

输出格式

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

输入输出样例

  • 输入#1

    3 2
    3 1 2

    输出#1

    1110
  • 输入#2

    3 1
    3 1 2

    输出#2

    1010010
  • 输入#3

    3 0
    3 1 2

    输出#3

    1000000000000000001010010
  • 输入#4

    2 1
    1 1

    输出#4

    0

说明/提示

For each of the testcases 11 to 33 , A={23,21,22}={8,2,4}A = \{2^3,2^1,2^2\} = \{8,2,4\} and E=824E=8\wedge 2\wedge 4 .

For the first testcase, there is only one possible valid unambiguous expression E=824=14=(1110)2E' = 8\oplus 2\oplus 4 = 14 = (1110)_2 .

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

  • 824=148\oplus 2\oplus 4 = 14
  • 824=644=688^2\oplus 4 = 64\oplus 4= 68
  • 824=816=248\oplus 2^4 = 8\oplus 16= 24

XOR of the values of all of these is 146824=82=(1010010)214\oplus 68\oplus 24 = 82 = (1010010)_2 .For the third testcase, there are four possible valid unambiguous expressions EE' :

  • 824=148\oplus 2\oplus 4 = 14
  • 824=644=688^2\oplus 4 = 64\oplus 4= 68
  • 824=816=248\oplus 2^4 = 8\oplus 16= 24
  • (82)4=644=224=16777216(8^2)^4 = 64^4 = 2^{24} = 16777216

XOR of the values of all of these is 14682416777216=16777298=(1000000000000000001010010)214\oplus 68\oplus 24\oplus 16777216 = 16777298 = (1000000000000000001010010)_2 .For the fourth testcase, A={2,2}A=\{2,2\} and E=22E=2\wedge 2 . The only possible valid unambiguous expression E=22=0=(0)2E' = 2\oplus 2 = 0 = (0)_2 .

首页