You are given the following:
Two integers ( N ) and ( K ) An array ( A ) of size ( N )
Let sequence B=(B1,B2,…,B2K))
of size 2K be a subsequence of array A .
Let's define F(B) as:
F(B)=[(B1|B2|…|BK)⊕(BK+1|BK+2|…|B2K)]
Where | denotes the bitwise OR operation and ⊕
denotes the bitwise XOR operation.
Task
Determine the maximum value of F(B) for all possible sequences B .
[1≤T≤102]
[2≤N≤1001]
[1≤K≤⌊N2⌋]
[0≤Ai<27]
Note: A sequence ( X ) is a subsequence of sequence ( Y ) if ( X ) can be obtained from ( Y ) by deleting several (possibly zero or all) elements without changing the order of the remaining elements.
Can anyone help me with this?