correct implementation, there was no need for all permutations, only sort and multply the bigger numbers with the smaller ones for each vector