title: Sum of rows in the matrix with the biggest minimal
body: <p>I have two matrix, let me call them ones_matrix and zero_matrix</p>
  
  <p>I need to create new list which is sum of best 20 rows from this matrixes like 10 rows from first and 10 rows from second where minimal element in summed list is biggest. </p>
  
  <p>So it is greedy alghorhytm where I am choosing the best row from matrix to add on each step. 10 times for onesMatrix and 10 times for zero_matrix and 10 times for ones_matrix and also execluding repetitions of rows. </p>
  
  <p>Each time we need to add something we haven't added before.
  My input is two 64 x 128 matrix which contains only ones and zeros. </p>
  
  <p>So my answer cant be bigger then 20, because I am summing 20 rows with zeros and ones and sum of 20 rows which contains only ones is 64*[20] with minimal element - 20.
   Here is my code:</p>
  
  <pre><code>ignored=set()
  res=np.zeros(128)
  for i in range(10):
      j=best(res,ones_matrix,ignored)
      res=res+ones_matrix[j]
      ignored.add(j)
      j = best(res, zero_matrix,ignored)
      res = res + zero_matrix[j]
      ignored.add(j)
  
  def best(res,matrix,ignored):
  for i in range(len(matrix)):
      matrix[i]=matrix[i]+res
  m=min(matrix[0])
  index=0
  for i in range(len(matrix)):
      if (min(matrix[i])&gt;=m and i not in ignored):
          index=i
          m=min(matrix[i])
  print(index)
  return index
  </code></pre>
  
  <p>These matrix are contains only zeros and nulls, so max element in my new row cant be bigger then 20( cause I am adding 20 rows which contains from nulls and zeros). But when I use</p>
  
  <pre><code>print(min(res))
  </code></pre>
  
  <p>I am getting huge value like 44266.0
  How can I make this work?</p>
  
  <p>Best row is row with the biggest minimal element.</p>