you give group point group size1 point second group size2 point size1 size2the cost connection point give size1 x size2 matrix costij cost connect point group point j second group the group connect point group connect point opposite group in word point group connect point second group point second group connect point groupreturn minimum cost take connect group Example 1input cost 15 96 36 2output 17explanation the optimal way connect group is1a2bthis result total cost 17example 2input cost 1 3 5 4 1 1 1 5 3output 4explanation the optimal way connect group is1a2b2c3athis result total cost 4note multiple point connect point 2 group point a second group this matter limit number point connect we care minimum total costExample 3input cost 2 5 1 3 4 7 8 1 2 6 2 4 3 8 8output 10 Constraintssize1 costlengthsize2 costilength1 size1 size2 12size1 size20 costij 100