#C12418. Power Set Generation
Power Set Generation
Power Set Generation
You are given a list of distinct integers. Your task is to generate its power set, i.e. all possible subsets of the list. The subsets should be printed in non-decreasing order of their sizes, and for subsets of the same size, in lexicographical order (based on the natural order of the numbers).
Note: The order of elements within each subset should be in increasing order. If a subset is empty, output an empty line.
Example:
Input: 3 1 2 3</p>Output:
1 2 3 1 2 1 3 2 3 1 2 3
inputFormat
The first line of input contains an integer n representing the number of integers in the list. The second line contains n space-separated distinct integers. If n is 0, the list is empty.
outputFormat
Print all the subsets (the power set) of the given list, one subset per line. For each subset, output the elements separated by a single space. For the empty subset, output an empty line. The subsets must be printed sorted first by their size (in increasing order) and then lexicographically.
## sample1
5
5
</p>