#P13565. 「CZOI-R5」按位或
「CZOI-R5」按位或
Problem Description
You have a sequence of length . Now you can perform at most operations. In each operation, you may choose an index and change to . Find the minimum possible value of the bitwise OR of the final sequence , that is, the minimum of .
refers to the bitwise OR operation.
Input Format
The first line contains an integer , denoting the length of the sequence.
The second line contains integers, denoting the sequence .
The third line contains an integer , denoting the maximum number of operations.
Output Format
Output one integer on the first line, denoting the answer.
3
5 1 4
1
5
2
1 2
1
2
Hint
[Sample Explanation #1]
You may choose to perform no operations.
[Sample Explanation #2]
Choose , then becomes , and the bitwise OR of the sequence is .
[Constraints]
This problem uses bundled testdata.
- Subtask #1 (): , , .
- Subtask #2 (): , , .
- Subtask #3 (): , .
- Subtask #4 (): No special constraints.
For of the data, , , .
Translated by ChatGPT 5