How do I solve this problem in CPP? You are in a rectangular maze of size MxN.You start from the cell(1,1) and need to exit at cell(X,Y). You can move 1 unit up, left, right in 1 unit of time. Some cells in the grid are blocked represented by 1 and the cells free to move are represented by 0. Starting cell is never blocked at the beginning. State of some cells toggles i.e if the cells were blocked they become free to move and vice versa. Location of the cells and times at which it toggles is given.
Determine the minimum time required to exit the maze. If the exit is not possible, print “not possible”.
Input: M: number of rows N:number of columns X,Y: X and Y coordinates of exit gate T: number of toggles Maze: 2D matrix of size mxn; Toggle: a 2D array of size Tx3 where each row contains three integers u,v,w where (u,w) represents the cell to be toggled and w represents the time of toggle at that cell.