F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

three arrays

Time Limit: 3000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 2773    Accepted Submission(s): 906


Problem Description
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$.
 

Input
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$
 

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

Sample Input
1 3 3 2 1 4 5 6
 

Sample Output
4 4 7
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-24 18:15:44, Gzip enabled