CRUSH_F - The CRUSH Factor
“
Excuse me…
I am not a Stalker.
I am a Researcher,
And you just happened
To be a good subject…
”
This is the Note XOXO has sent as a text to his CRUSH to impress her. In reply, his crush COCO has sent him an array of 2*N numbers and asked XOXO to find out the CRUSH_Factor of that array.
What is a CRUSH_Factor?
If A is an array of length N, then,
CRUSH_Factor = min( AN-N+i ⊕ AN-N+i+1 ); ∀ i ∈ [1,N-1]
Formally, CRUSH_Factor is the minimum bitwise XOR between all the adjacent elements of an array.
Now, as being a programmer, XOXO have the ability of modifying the initial array provided by COCO as a text. XOXO can change the array arrangement by doing one of the following two operations on each move.
If A is an array of 2*N numbers. Then the moves are:
- Swap A1 and A2, A3 and A4, …… , A2*N-1 and A2*N
- Swap A1 and AN+1, A2 and AN+2, …… , AN and A2*N
Now, you have to help XOXO find an optimal organization of the array. That is, you have to find the Maximum achievable CRUSH_Factor and the minimum moves to find it.
Constraints:
1 <= N <= 1000
1 <= Ai <= 10000000
Sample I/O:
Input:
4
6 5 8 7 2 1 4 3
Output:
The Maximum achievable CRUSH Factor is 3 and Min move(s) to find it is 0
Added by: | Dr. AddictStein |
Date: | 2022-02-11 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Dr. AddictStein Research Lab |