#include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define fs first
#define sd second
const int inf = int(1e9);
struct Node{
Node* d[2];
int V;
Node(){ d[0] = d[1] = 0; V = inf;}
};
int N;
Node * root;
void addNumber(int X, int i){
Node * C = root;
C->V = min (C->V, i);
for (int j = 20; j >= 0; j--){
int B = ((X >> j) & 1);
if (C->d[B] == 0)
C->d[B] = new Node();
C = C->d[B];
C->V =min (C->V, i);
}
}
int main(){
//freopen("F.inp", "r", stdin);
scanf("%d", &N);
int X = 0, L, R, M = 0, A, Y, B;
root = new Node();
addNumber(0, 0);
for (int i = 1; i <= N; i++){
scanf("%d", &A);
X ^= A; Y = 0;
Node * C = root;
//printf ("i=%d, X=%d\n",i,X);
for (int j = 20; j >= 0; j--){
B = !((X >> j) & 1);
if (C->d[B] == 0) B = !B;
Y += (B << j) ^ (X & (1 << j));
C = C->d[B];
}
if (Y > M) M = Y, L = C->V + 1, R = i;
addNumber(X, i);
}
printf("%d %d %d\n", M, L, R);
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
./Main.cpp:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result