AT_icpc2013summer_warmingUp_f Maximum Segment XOR

Description

[problemUrl]: https://atcoder.jp/contests/jag2013summer-warmingup/tasks/icpc2013summer_warmingUp_f XOR is the operation as basic as addition for programmers. 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. The first line of the input file contains $ N $ ($ 1\ \leq\ N\ \leq\ 10^5 $). The second line contains $ N $ integers $ \{a_i\} $ ($ 0\ \leq\ a_i\ ). $ Output the maximal value and the pair of $ (s,\ t) $ which gives the maximum. If there are multiple pairs, output the lexicographically smallest one. ``` 5 1 2 3 4 5 ``` ``` 7 3 4 ``` ``` 3 3 3 3 ``` ``` 3 1 1 ``` ``` 4 1 2 4 8 ``` ``` 15 1 4 ```

Input Format

N/A

Output Format

N/A