题目描述
Demodogs from the Upside-down have attacked Hawkins again. El wants to reach Mike and also kill as many Demodogs in the way as possible.
Hawkins can be represented as an n \times nn×n grid. The number of Demodogs in a cell at the ii -th row and the jj -th column is i \cdot ji⋅j . El is at position (1, 1)(1,1) of the grid, and she has to reach (n, n)(n,n) where she can find Mike.
The only directions she can move are the right (from (i, j)(i,j) to (i, j + 1)(i,j+1) ) and the down (from (i, j)(i,j) to (i + 1, j)(i+1,j) ). She can't go out of the grid, as there are doors to the Upside-down at the boundaries.
Calculate the maximum possible number of Demodogs \mathrm{ans}ans she can kill on the way, considering that she kills all Demo