You are provided an array \(Arr \) of non-negative integers of size \(2*K\). In each round, pick any two integers from the array \(Arr \) (\(number1\) and \(number2\)) and then eliminate both of them.
The formula for your score in each round is = \(RoundNumber\)\(*( \)\(number1\)\(\&\)\(number2). \)
RoundNumber will start from \(1\) till \(K\), and "\(number1\)\(\&\)\(number2\)" represents bitwise AND of \(number1\) and \(number2 \). The total number of rounds is \(K\). The sum of the scores you will receive in each round will represent your final score. Return the maximum possible final score.
Input Format:
- The first line contains an integer \(N\), where \(N\) denotes the size of the array \(Arr\).
- The second line contains an interger \(K\).
Output Format:
- Print the maximum possible final score.
Constraints:
- \(1 \le K \le 10\)
- \(1 \leq N \leq 20\)
- \(1 \le Arr[i] \le 10^7\)
- \(N = 2*K\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial