Yet another challenge for Roy!
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
Both Hridoy and Roy enjoy solving mathematical puzzles as well as they are very close friends. They like challenging one another constantly, in keeping with this pattern, Hirdoy gave Roy a bitwise XOR problem which is very interesting for the bit lover. Hridoy set an array of N integers (\(A_1\), \(A_2\),... +\(A_N\)) together with an integer value (K). Roy was allowed to select a number X within this range which is 0 ≤ X ≤ K, By Choosing this X, Roy had to determine the maximum value of F(X) = (\(A_1\) ⊕ X) + (\(A_2\) ⊕ X) +... + (\(A_N\) ⊕ X).
Roy is asking for your assistance in fixing this problem since he is finding it tough to do so because of his busy schedule.
NOTE: ⊕ means XOR where XOR is a bitwise operator, and it stands for "exclusive or." It performs logical operation. If input bits are the same, then the output will be false(0) else true(1)
Input
The first line contains two integers N (3 ≤ N ≤ \(10^5\)) and K (1 ≤ K ≤ \(10^{12}\))
The second line contais N integers \(A_1\) , \(A_2\) ,,, \(A_N\) (1 ≤ \(A_N\) ≤ \(10 ^ {12}\))
Output
Print the maximum Value of F
Sample
Input | Output |
---|---|
|
|
Brain Booster #3
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 9
- Start at
- 2024-05-06 15:00
- End at
- 2024-05-06 18:00
- Duration
- 3.0 hour(s)
- Host
- Partic.
- 91