Can some hint be provided, please? how to solve it.
Mike and infinite Grid
Hey
We know that a player can only move such that, and . So we can say that size of the grid is atmost (see the constraints). Let represent whether is a winning position or not. If there is a winning position in row or column or diagonal passing from , then the position is a losing position, otherwise its winning position.
We can precompute the winning positons, on a 1000*1000 grid.