I am trying this [question][1] and I am well aware that its solution is [here][2]. Can we do it in different approach using maximum contiguous sub sequence of dynamic programming? ie. instead of recurrence relation being s[i]=max{S[i-1]+A[i],A[i]} can we use S[i]=max{S[i-1]^A[i],A[i]} and maximum among S[i] being the answer?

My code is [here][3] and its passing the sample test cases, but i am getting WA as verdict using this method.

so is the method right or any problem is there in my code.

[1]: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=345&page=show_problem&problem=2683

[2]: http://discuss.codechef.com/questions/22710/xor-sum-acm-amritapuri-2009

[3]: http://ideone.com/qakFTm