Images:

I'd like some hints to the ??? pointed out as well as how to approach the case in which the X,Y are opposite corners.
P.S. This is a problem which I came up with after a conversation with a friend. So I do not know what the answer is/whether this is a standard textbook problem. Googling has yielded a somewhat similar paper here. However, there each cell/node has an independent probability of being filled.