#C8506. Remove Duplicate Orders
Remove Duplicate Orders
Remove Duplicate Orders
You are given a list of orders. Each order is represented by a list of integers. For each order, first remove any duplicate items, and then sort the remaining items in non-decreasing order. Two orders are considered identical if their processed forms (i.e. sorted list of unique items) are equal. Your task is to remove duplicate orders, keeping only the first occurrence of each distinct processed order.
Formally, for an order (A_i) with items, let its processed order be (P_i = sorted({A_i})). You must output all distinct (P_i) in the order of their first appearance.
For example, if an order is given as [2, 3, 1, 3] then its processed form is (P = [1, 2, 3]). If later another order also processes to ([1,2,3]), it should be ignored.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) (the number of orders). Each of the next (n) lines starts with an integer (k) (the number of items in the order) followed by (k) integers representing the items of the order.
Example:
7 3 2 3 1 3 5 3 2 4 4 1 2 3 3 1 2 3 3 3 2 1 3 2 5 3 4 2 4 1 3
outputFormat
Print the distinct processed orders to standard output (stdout). Each processed order should be printed on a new line as space-separated integers.
For the input example above, the expected output is:
1 2 3 2 3 5 1 2 3 4## sample
7
3 2 3 1
3 5 3 2
4 4 1 2 3
3 1 2 3
3 3 2 1
3 2 5 3
4 2 4 1 3
1 2 3
2 3 5
1 2 3 4
</p>