|
|
back to board> Please, give me any hint. Take an array 1..max, 1..max of longint that i,j element includes sum of numbers in 1..i 1..j rectangle - that you can calculate easily by n*n (I hope) than in n^4 cmplesity take all variants of different rectangles and calc their sum in linear time. I think my English take success with your mind You must easily find maximum sum in vector for O(n), only fixed two parameters of submatrix(e.g. top && bottom). |
|
|