[Solution] NIT orz! Codeforces Solution | Codeforces Problem Solution 2022
NIT, the cleaver, is new in town! Thousands of people line up to orz him. To keep his orzers entertained, NIT decided to let them solve the following problem related to . Can you solve this problem too?
You are given a 1-indexed array of integers, , and an integer . You can do the following operation any number (possibly zero) of times:
- Select a positive integer such that . Then, simutaneously set to and set to . In other words, let and respectively be the current values of and . Then set to and set to .
Here and denote the bitwise operations OR and AND respectively.
Find the maximum possible value of the maximum value in after any number (possibly zero) of operations.
The first line of each test case contains two integers and (, ).
The second line of each test case contains integers ,,, ().
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, print one integer — the answer to the problem.
No comments:
Post a Comment