409583: GYM103637 K K-ones xor

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. K-ones xortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given integers $$$n, m$$$ and an array $$$a_1, a_2, ... , a_n$$$ of length $$$n$$$ consisting of $$$m$$$-bit integers. You are also given an integer $$$k$$$. You need to find $$$m$$$-bit integer $$$x$$$, which has no more than $$$k$$$ ones in binary representation. Out of all this numbers, you need to find such number, that after applying $$$a_i = max(a_i, a_i \oplus x)$$$ to the array, sum of the array will be maximal. $$$\oplus$$$ denotes the operation of bitwise $$$XOR$$$. If there are multiple such numbers, you need to find the minimal one.

Input

The first line of input file contains three integers $$$n, m, k$$$. The second line of input file contains the array $$$a_1, a_2, ... , a_n$$$.

$$$$$$1 \le n \le 10^5$$$$$$ $$$$$$1 \le m \le 30$$$$$$ $$$$$$0 \le k \le m$$$$$$ $$$$$$0 \le a_i < 2^m$$$$$$

Output

Output single number $$$x$$$ - answer for the task. $$$$$$0 \le x < 2^m$$$$$$

ExamplesInput
3 2 2
3 2 2
Output
1
Input
2 1 1
0 0
Output
1

加入题单

上一题 下一题 算法标签: