Printing lexographically smallest configuration
while ( ri < k && row [ ri ] == 1 ) { ri ++ ; } while ( ci < k && col [ ci ] == 1 ) { ci ++ ; } cout << ( ri + 1 ) << " ▁ " << ( ci + 1 ) << " STRNEWLINE " ; ri ++ ; ci ++ ; } }