307679: CF1395C. Boboniu and Bit Operations
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Boboniu and Bit Operations
题意翻译
波波牛给了你两个非负整数序列 $a_1,a_2...a_n$,$b_1,b_2...b_n$。 对于每个 $i\ (1 \leq i \leq n)$ ,你可以选择一个 $j \ (1 \leq j \leq m)$,并使得 $c_i=a_i \ \&\ b_j$。 你需要求出 $c_1|c_2|...|c_n$ 的最小值。题目描述
Boboniu likes bit operations. He wants to play a game with you. Boboniu gives you two sequences of non-negative integers $ a_1,a_2,\ldots,a_n $ and $ b_1,b_2,\ldots,b_m $ . For each $ i $ ( $ 1\le i\le n $ ), you're asked to choose a $ j $ ( $ 1\le j\le m $ ) and let $ c_i=a_i\& b_j $ , where $ \& $ denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND). Note that you can pick the same $ j $ for different $ i $ 's. Find the minimum possible $ c_1 | c_2 | \ldots | c_n $ , where $ | $ denotes the [bitwise OR operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND).输入输出格式
输入格式
The first line contains two integers $ n $ and $ m $ ( $ 1\le n,m\le 200 $ ). The next line contains $ n $ integers $ a_1,a_2,\ldots,a_n $ ( $ 0\le a_i < 2^9 $ ). The next line contains $ m $ integers $ b_1,b_2,\ldots,b_m $ ( $ 0\le b_i < 2^9 $ ).
输出格式
Print one integer: the minimum possible $ c_1 | c_2 | \ldots | c_n $ .
输入输出样例
输入样例 #1
4 2
2 6 4 0
2 4
输出样例 #1
2
输入样例 #2
7 6
1 9 1 9 8 1 0
1 1 4 5 1 4
输出样例 #2
0
输入样例 #3
8 5
179 261 432 162 82 43 10 38
379 357 202 184 197
输出样例 #3
147