Pagini recente » Cod sursa (job #2744985) | Cod sursa (job #1826002) | Cod sursa (job #3192018) | Cod sursa (job #2065490) | Cod sursa (job #2637672)
#include <cstdio>
using namespace std;
const int NMAX = 100000;
int xorp[NMAX + 5];
int main()
{
freopen("xormax.in" , "r" , stdin);
freopen("xormax.out" , "w" , stdout);
int n , i , j , xormax , st , dr , x;
scanf("%d" , &n);
for(i = 1 ; i <= n ; i ++)
{
scanf("%d" , &x);
xorp[i] = (xorp[i - 1] ^ x);
}
xormax = 0;
for(i = 1 ; i <= n ; i ++)
for(j = i ; j >= 1 ; j --)
if((xorp[i] ^ xorp[j - 1]) > xormax)
{
xormax = (xorp[i] ^ xorp[j - 1]);
st = j;
dr = i;
}
printf("%d %d %d\n" , xormax , st , dr);
return 0;
}