F - Maximum Segment XOR
Editorial
/

XOR is the operation as basic as addition for programmers.

Genius programmer KM made the following problem to test his disciple wata.

Given

wata couldn't solve this problem, so he asked you, the friend of him and the excellent programmer, to solve this problem for him.

The first line of the input file contains

The second line contains

Output the maximal value and the pair of

If there are multiple pairs, output the lexicographically smallest one.

Time Limit: 1.5 sec / Memory Limit: 93 MB

### Description

Genius programmer KM made the following problem to test his disciple wata.

Given

`N`integers

`\{a_i\}`, find the two integers

`s`and

`t`(

`1 \leq s \leq t \leq N`) such that

`a_s\^a_{s+1}\^…\^a_t`is maximum possible.

wata couldn't solve this problem, so he asked you, the friend of him and the excellent programmer, to solve this problem for him.

### Input

`N`(

`1 \leq N \leq 10^5`).

The second line contains

`N`integers

`\{a_i\}`(

`0 \leq a_i < 2^{20}`).

### Output

`(s, t)`which gives the maximum.

If there are multiple pairs, output the lexicographically smallest one.

### Sample Input

5 1 2 3 4 5

### Sample Output

7 3 4

### Sample Input

3 3 3 3

### Sample Output

3 1 1

### Sample Input

4 1 2 4 8

### Sample Output

15 1 4