2650The Maximum Number

2650   The Maximum Number

题目描述

Forever97 has two sequences of number. One of them consists of n positive integer numbers a1, a2, ..., an. And the other one consisted of m positive integer numbers b1, b2, …, bn. Now Forever97 needs to get the maximum value of bitwise xor of one integer from the sequence a and one integer from the sequences b.

输入格式:

The input contains several test cases.

The first line contains two integer numbers n and m (1≤n, m≤105).

The second line contains n integer numbers a1, a2, ..., an (1≤ai≤109).

The third line contains m integer numbers b1, b2, ..., bm (1≤bi≤109).

输出格式:

For each test case, you should output the maximum number Forever97 can get.

输入样例 复制
3 3
1 2 3
4 5 6
输出样例 复制
7

说明

6
29
通过提交
时空限制3000ms/128mb
题目来源数据结构实验与竞赛训练
评测方式在线评测
题目类型
难        度