• The question is very confusing

The question is very confusing. I suppose this is because you have x and y reversed in your description. Perhaps if you change "x,y" to "row,column" it would make more sense.

It's also not very clear that (1,1) is the top left and not (0,0) as most programmers expect.