Comments

In this case, 3 S10 101 01F He cannot reach to grid[n][n],then why we have to invert the squares grid[1][2] and grid[2][1]?

In problem A,I just did a loop to find the x and for all the pair in the test case 1,I got 0.

On problem B, can anyone please tell me what does this statement really means "Waters can move from a square to any other square adjacent by a side, as long as he is still in the grid". Can Waters move from grid[i][j] to grid[i+1][j+1]?

I found out the logic later that I had to get exactly at the point x,y..Thank you.

I got it later...Thanks

On problem B in test case 1,15 is the maximum number and we have to reach at the point 10.So only 1 hop is needed in my opinion.So why max(2,ceil(d/max)) is the solution?