#P10448. Combinatorial Selection

    ID: 12457 Type: Default 1000ms 256MiB

Combinatorial Selection

Combinatorial Selection

Given (n) integers from (1) to (n), choose (m) of them at random and output all possible selection schemes. Each combination should list the chosen numbers in ascending order. This problem requires you to generate all (m)-combinations from the set ({1,2,\dots,n}).

inputFormat

The input consists of two integers, (n) and (m), separated by a space.

outputFormat

Output all possible combinations of choosing (m) integers from (1) to (n). Each combination should be printed on a new line with the numbers separated by a space, and the combinations must be in lexicographical order.

sample

4 2
1 2

1 3 1 4 2 3 2 4 3 4

</p>