Query Bits RE error


This code is giving WA in 2nd TC and RE in rest of the TC. Kindly highlight the mistakes in the code.

Hey Anant
Your pow array is of integer type, it should be long type since MOD range is long

Hi Aarnav
I have done the said changes, still none of the TC is passing. Kindly help.

I have put the comments for your reference to the best of my understanding.

You cannot declare 4*n+1 size array in main function,because n is large in this case, I have declared this array in main. This has fixed your RE. And there was a mistake in taking mod as well, Since print was returning negative values you need to add the mod and then again take modulus.

Hey, I have tried to remove the possibility of negative output by adding mod everytime before taking modulus but it’s still giving WA.

@er.garganant
You can refer to my code - https://ide.codingblocks.com/s/182736.

1 Like