Question : " Problem - B - Codeforces"

My solution : " Submission #114366094 - Codeforces"

I don’t know why it give me WA at 79th input ( i m unable to see TC ) .Help

Question : " Problem - B - Codeforces"

My solution : " Submission #114366094 - Codeforces"

I don’t know why it give me WA at 79th input ( i m unable to see TC ) .Help

1

5

1 2 1 3 4

Try this test case. According to you the answer is 12 but actual answer is 0.

It’s wrong , x should be the AND of all the numbers in the array and not Minimum value

Link to my submission

Actually if x exits then it will be minimum in array else x will be 0.

Also, ith bit will be set in x if only if ith bit is set in all the elements of array

Why ?

The proof is given in the editorial that AND of all prefixes and AND of all suffixes should be same