Write a program that prints all the permutations of with inversions, for a given and . An inversion is a pair of elements and such that and such that appears before in the permutation.
Input consists of two natural numbers and , such that and .
Print all the permutations of with inversions.
You can print the solutions to this exercise in any order.
Here, a very simple algorithm may be too slow.
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T11:39:59.304Z
© Jutge.org, 2006–2026.
https://jutge.org