This is the problem that i hav been trying to solve…here’s my code
int main()
{
int t,n,a[100010],i,j;
int dp[2][100010],sum=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
a[0] = 0;
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
memset(dp,0,sizeof(dp));
i=1;
sum=0;
dp[1][1] = a[1];
for(j=2;j<=n;j++)
{
dp[i][j] = dp[i][j-1] ^ a[j];
sum+=dp[i][j];
}
for(i=2;i<=n;i++)
{
for(j=i+1;j<=n;j++)
{
dp[1][j] = dp[1][j] ^ a[i-1];
sum+=dp[1][j];
}
}
for(i=1;i<=n;i++)
sum+=a[i];
printf("%d\n",sum);
}
return 0;
}
Getting WA repeatedly…Is there any corner case am missing…??..Any help will be much appreciated…