Problem B. three arrays

时间限制 2500 ms   内存限制 256 MB

There are three integer arrays $a, b, c$. The lengths of them are all $N$. You are given the full contents of $a$ and $b$. And the elements in $c$ is produced by following equation: $c[i] = a[i]\ XOR\ b[i]$ where $XOR$ is the bitwise exclusive or operation.

Now you can rearrange the order of elements in arrays $a$ and $b$ independently before generating the array $c$. We ask you to produce the lexicographically smallest possible array $c$ after reordering $a$ and $b$. Please output the resulting array $c$.
 

输入数据

The first line contains an integer $T$ indicating there are $T$ tests.

Each test consists of three lines. The first line contains one positive integer $N$ denoting the length of arrays $a, b, c$. The second line describes the array $a$. The third line describes the array $b$.

* $T \le 1000$

* $1 \le N \le 10^5$

* integers in arrays $a$ and $b$ are in the range of $[0, 2^{30})$.

* at most $6$ tests with $N > 100$
 

输出数据

For each test, output a line containing $N$ integers, representing the lexicographically smallest resulting array $c$.
 

样例输入

复制
1
3
3 2 1
4 5 6

样例输出

复制
4 4 7

提交

请先 登录

© 2025 FAQs Contact About