TLE in XOR Engine, help

don’t know how to make it faster than this. please, help!

You can precalculate the number of elements having even and odd no. of set bits in the given sequence.
Later based on input integer in query having even or odd no. of set bits, u can print the output.

Can refer the soln. - CodeChef: Practical coding for everyone

1 Like