6961.And Subset Count

Time Limit: 1s Memory Limit: 512MB

You are given an array of $n$ integers. Your task is to calculate the number of non-empty subsets whose elements' bitwise and is equal to $k$ for each $k = 0, 1,\dots, n$ .

Input Format(From the terminal/stdin)

The first line has an integer $n$ : the size of the array.

The next line has $n$ integers $a_1, a_2,\dots, a_n$ : the contents of the array.

  • $1 \le n \le 2 \cdot 10^5$
  • $0 \le a_i \le n$

Output Format(To the terminal/stdout)

Print $n + 1$ integers as specified above modulo $10^9 + 7$ .

Sample Input

Copy
4
3 1 3 4
 \n
 · · · \n

Sample Output

Copy
7 4 0 3 1
 · · · · \n
Source: CSES, Bitwise Operations, 3141

Submit

请先 登录

© 2025 FAQs