Given Size
int n = B . length ; for ( int i = 0 ; i < 50 ; i ++ ) for ( int j = 0 ; j < 50 ; j ++ ) for ( int k = 0 ; k < 50 ; k ++ ) for ( int l = 0 ; l < 50 ; l ++ ) dp [ i ] [ j ] [ k ] [ l ] = - 1 ;