题目描述
Problem Description
The world is in a state of flux, and you want to accomplish something significant. Naturally, this requires the participation of people, and you can select a portion from $n$ individuals to join your grand endeavor.
To accomplish this task, it involves $k$ types of abilities, such as the ability to persuade others, to play games, or to sleep. Each person possesses certain abilities; for example, a robotic cat might be good at sleeping and playing games but not at persuading others.
Your plan is ambitious, so you want the team to have a comprehensive set of abilities. Unfortunately, if an even number of people in the team possess the same ability, they will split into two factions, leading to disputes and the team losing that ability. Conversely, if an odd number of people possess a certain ability, they can always form a majority to handle that aspect of the work.
It's important to note that each ability the team possesses contributes differently to the success rate of the plan. The first ability is the most important, with a weight of $2^{k-1}$; the second ability has a weight of $2^{k-2}$; and so on. The $k$-th ability is the least important, with a weight of only $1$.
The success rate score of the plan is the sum of the weights corresponding to all the abilities the team possesses.
You want the success rate to be maximized. Therefore, you need to select the right individuals to participate in your grand plan.
Input Format
The first line contains two positive integers $n$ and $k$, representing the number of individuals you can choose from and the number of types of abilities, respectively.
The next $n$ lines describe the abilities of each person. Each line starts with an integer $c$, indicating how many abilities that person has; followed by $c$ positive integers between $[1, k]$, indicating which abilities that person possesses.
Output Format
A single line containing an integer, representing the success rate score of the plan.
Sample Input and Output
Sample Input #1
5 5
1 1
1 2
1 3
1 4
1 5
Sample Output #1
31
Sample Input #2
3 5
3 1 2 3
4 2 3 4 5
2 3 4
Sample Output #2
28
Sample Input #3
3 5
2 1 2
3 5 3 2
3 4 2 5
Sample Output #3
30
Sample Input #4
21 60
0
0
3 60 27 48
0
1 48
2 52 14
2 4 31
0
0
2 28 43
2 6 31
0
1 7
3 45 6 48
0
1 51
0
2 28 20
2 37 51
1 8
53 59 39 29 23 53 27 13 16 44 34 38 24 9 32 58 54 31 1 7 45 3 30 36 17 48 42 22 18 21 6 11 25 33 37 52 10 60 49 57 2 28 8 14 5 47 4 41 35 43 50 46 26 12
Sample Output #4
1152884121210322895
Notes
Sample Explanation
For the first sample, there are 5 people, each with a different ability. The final selection is to include all 5 people in the plan, scoring $16+8+4+2+1 = 31$.
For the second sample, we choose to include only person $1$. The team then has abilities $1, 2, 3$, scoring $16+8+4=28$.
For the third sample, we include persons $1, 2, 3$. Since there is an even number of members with ability $5$, the team does not possess ability $5$. However, there is an odd number of members with ability $2$, so the team possesses ability $2$. Ultimately, the team has abilities $1, 2, 3, 4$, scoring $16+8+4+2=30$.
Data Size and Constraints
For $100\%$ of the data, $n \leq 21$ and $k \leq 60$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分