#K60417. Unique Cocktail Combinations
Unique Cocktail Combinations
Unique Cocktail Combinations
You are given a set of n spirits and m cocktail combinations. Each cocktail combination is represented by a list of spirit IDs. Two cocktails are considered the same if they contain exactly the same set of spirits (i.e. order does not matter). Your task is to compute the maximum number of unique cocktails that can be made.
The unique property is determined by the set equality. For example, the combinations [1, 2]
and [2, 1]
are considered identical. Mathematically, if we denote a cocktail combination as a set \( S \subseteq \{1, 2, \ldots, n\} \), two cocktails \( S_1 \) and \( S_2 \) are identical if \( S_1 = S_2 \).
Input constraints: \( n \ge 0 \) and \( m \ge 0 \).
inputFormat
The input is given via standard input in the following format:
<n> <m> <cocktail combination 1> <cocktail combination 2> ... <cocktail combination m>
Each cocktail combination is a space-separated list of spirit IDs. If m is 0, no cocktail combinations follow.
outputFormat
Output to standard output a single integer representing the maximum number of unique cocktails.
## sample3 4
1 2
2 3
1 2 3
3
4