Function to check if the given matrix satisfies the given condition or not
static void checkGoodMatrix ( int [ , ] mat ) { List < int > P = new List < int > ( ) ; List < int > S = new List < int > ( ) ; List < int > MR = new List < int > ( ) ; List < int > MC = new List < int > ( ) ;