Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
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.
Input | Output |
---|---|
2 1 1 1 10 10 10 | 1 3780 |
31% Solution Ratio
sansaquaEarliest,
BigBagFastest, 0.1s
Matrix.codeLightest, 3.1 MB
amurtoShortest, 2075B
Login to submit
Alternate Writer upobir(Sabbir Rahman) came up with a nice solution. If we choose A and B such that ...