When you want the permutations in reverse order use prev_permutation instead of next_permutation.