Cod sursa(job #864268)
#include <fstream>
#define i64 long long
using namespace std;
ifstream cin("xormax.in");
ofstream cout("xormax.out");
const int NMAX = 100002;
int N;
int a[NMAX];
//O(N^2)
void brute() {
int xorMax = 0;
int l = -1, r = -1;
for(int i = 1;i <= N;i++) {
int currXor = 0;
for(int j = i;j >= 1;j--) {
currXor ^= a[j];
if(currXor > xorMax) {
xorMax = currXor;
l = j;
r = i;
}
}
}
cout<<xorMax<<" "<<l<<" "<<r<<"\n";
}
void readData() {
cin>>N;
for(int i = 1;i <= N;i++) {
cin>>a[i];
}
}
int main()
{
readData();
brute();
return 0;
}