MATDYS - Editorial

Didn’t work with that too. Still AC on 1&2 subtask and WA on 3rd

Suffering from floating errors. If you use “K>>=1” and “N!>>=1” instead of dividing K by 2, you will get AC. Still looking why your K behaves weirdly, but I am no python user :frowning:

EDIT: Refer to “//” and “/” operator, and their difference.

Floating point divison has an error of about {10}^{-9} ,and that matters a LOT here :frowning:

2 Likes

Got another reason to hate python :frowning: c++ is my regular one.

Thanks Vijju123 Got AC

0246|1357. See 1 = 0+1, 3 = 2+1 and so on. Similar for other iterations. See the ‘|’ in editorial to indicate blocks.

overflow issues…didn’t you check 2nd sample case given ??

@ayushgoyal1703, No. You can check my solution(editorialist) as well.

That’s reversing the binary representation. And you would usually use << operator to get a power of 2.

There is even a shorter way to do this. :slight_smile: CodeChef: Practical coding for everyone