The link to the question

https://www.codechef.com/BITM2021/problems/HBOB02

The link to the solution which gave WA

https://www.codechef.com/viewsolution/42134487

How is this solution wrong , My proof : whenever a no. Is encountered with the kth bit set then if the previous element’s xor contains kth bit as set it becomes unset and if not then it becomes set. So we have to just count the no. of times the kth bit becomes set and unset.

I have solved this problem with another approach.

Please tell me how is this solution wrong.

1 Like

Why not just do what the problem says?

I did that , I said I had solved the problem , but at first I thought of this solution which was wrong , so I am thinking how it is wrong.