| FMI No Stress 11 |
|---|
| Finished |
After a tiring practical test at OOP, Rares is faced with a new challenge. He has to solve the following problem, otherwise he will fail the Programming class.
Let $$$v$$$ be an array of $$$n$$$ non-negative integers. Find the maximum value of ($$$v_i$$$ $$$\oplus$$$ $$$v_j$$$) $$$\times$$$ ($$$v_k$$$ + $$$v_l$$$), where $$$1$$$ $$$\le$$$ $$$i \lt j \lt k \lt l$$$ $$$\le$$$ $$$n$$$. Here $$$\oplus$$$ represents the bitwise xor operation.
Help Rares save his GPA!
The first line of the input contains $$$n$$$ ($$$4$$$ $$$\le$$$ $$$n$$$ $$$\le$$$ $$$200000$$$), the size of the given array.
The next line contains $$$n$$$ non-negative integers $$$v_1$$$, $$$v_2$$$, ..., $$$v_n$$$ ($$$0$$$ $$$\le$$$ $$$v_i$$$ $$$\le$$$ $$$2^{30}-1$$$).
Output a single number, the maximum value of ($$$v_i$$$ $$$\oplus$$$ $$$v_j$$$) $$$\times$$$ ($$$v_k$$$ + $$$v_l$$$), where $$$1$$$ $$$\le$$$ $$$i \lt j \lt k \lt l$$$ $$$\le$$$ $$$n$$$.
6 12 42 2 0 145 7
6384
Rares chooses $$$i=2$$$, $$$j=4$$$, $$$k=5$$$, $$$l=6$$$. The value is ($$$42$$$ $$$\oplus$$$ $$$0$$$) $$$\times$$$ ($$$145$$$ + $$$7$$$) = $$$6384$$$.
| Name |
|---|


