CF1034E.Little C Loves 3 III

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Little C loves number «3» very much. He loves all things about it.

Now he is interested in the following problem:

There are two arrays of 2n2^n intergers a0,a1,...,a2n1a_0,a_1,...,a_{2^n-1} and b0,b1,...,b2n1b_0,b_1,...,b_{2^n-1} .

The task is for each i(0i2n1)i (0 \leq i \leq 2^n-1) , to calculate ci=ajbkc_i=\sum a_j \cdot b_k ( jk=ij|k=i and j&k=0j\&k=0 , where " | " denotes bitwise or operation and " &\& " denotes bitwise and operation).

It's amazing that it can be proved that there are exactly 3n3^n triples (i,j,k)(i,j,k) , such that jk=ij|k=i , j&k=0j\&k=0 and 0i,j,k2n10 \leq i,j,k \leq 2^n-1 . So Little C wants to solve this excellent problem (because it's well related to 33 ) excellently.

Help him calculate all cic_i . Little C loves 33 very much, so he only want to know each ci&3c_i \& 3 .

输入格式

The first line contains one integer n(0n21)n (0 \leq n \leq 21) .

The second line contains 2n2^n integers in [0,3][0,3] without spaces — the ii -th of them is ai1a_{i-1} .

The third line contains 2n2^n integers in [0,3][0,3] without spaces — the ii -th of them is bi1b_{i-1} .

输出格式

Print one line contains 2n2^n integers in [0,3][0,3] without spaces — the ii -th of them is ci1&3c_{i-1}\&3 . (It's obvious that ci&3c_{i}\&3 is in [0,3][0,3] ).

输入输出样例

  • 输入#1

    1
    11
    11
    

    输出#1

    12
  • 输入#2

    2
    0123
    3210
    

    输出#2

    0322
首页