There is a grid of size where Number of rows and Number of columns. You shall walk on the grid and you can only move from cell to or cell. You shall walk exactly cells on the way.
Let = Number of ways you can choose a sized subgrid from the grid such that you have to travel exactly cells including the starting cell to reach the bottom-right cell from the top-left cell of the subgrid.
Let = Number of ways you you can walk from the top-left cell to the bottom-right cell of the previously choosen sized subgrid. Note that, G(A,B) depends on the value of A and B only.
You have to to choose such and that the value of is maximum.
First line of the input will contain a positive integer number .
Each of the next lines will contain three positive integers , and .
For each case you have to print maximum value of modulo in a new line.
2 1 1 1 10 10 10
Login to submit
Alternate Writer upobir(Sabbir Rahman) came up with a nice solution. If we choose A and B such that ...