252A.md (1411B)
1 Source: https://codeforces.com/problemset/problem/252/A 2 3 A. Little Xor 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of *n* elements. Petya immediately decided to find there a segment of consecutive elements, such that the *xor* of all numbers from this segment was maximal possible. Help him with that. 22 23 The *xor* operation is the bitwise exclusive "OR", that is denoted as "xor" in Pascal and "^" in C/C++/Java. 24 25 Input 26 27 The first line contains integer *n* (1 ≤ *n* ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. 28 29 Output 30 31 Print a single integer — the required maximal *xor* of a segment of consecutive elements. 32 33 Examples 34 35 Input 36 37 ``` 38 5 39 1 2 1 1 2 40 ``` 41 42 Output 43 44 ``` 45 3 46 ``` 47 48 Input 49 50 ``` 51 3 52 1 2 7 53 ``` 54 55 Output 56 57 ``` 58 7 59 ``` 60 61 Input 62 63 ``` 64 4 65 4 2 4 8 66 ``` 67 68 Output 69 70 ``` 71 14 72 ``` 73 74 Note 75 76 In the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one. 77 78 The second sample contains only one optimal segment, which contains exactly one array element (element with index three).