Posts

Showing posts with the label sub-matrices Problems

All possible sub-matrices sums.

                                              Save the nature https://www.codechef.com/problems/SVNTR (Lunch Time oct 2015)  In this problem , you have to count number of sub-matrices whose sum is less than or equal to k (given). Approach for this problem : firstly calculate the all possible column sum , i.e for c number of columns ,there will be c*(c+1)/2 columns created.  for example : 1 2 3                                 1  3  6   2   5   3                        4 5 6                 --->>>     4  9  15  5  11  6   after creating "b" matrix from the given "a"  matrix.  Calculate all p...