Comments

Exactly what I was looking for. Thanks a lot.

I just wanted to know what if N<=100000 and the obstacles are less than 3000. How do you solve the problem then? I knew there is a method to iterate only on the obstacles but I forgot that method. Can anyone help?

I know this solution but can you figure-out what is wrong in my solution?

In problem 894B, how will you find 2^((m-1)*(n-1))? I mean the expression (m-1)*(n-1) can even be greater than a 64-bit integer.