| UTPC Contest 03-01-24 Div. 1 (Advanced) |
|---|
| Закончено |
It is National Welsh Corgi Day, and all the Corgis in Corgistan have gathered in a large grass field. Each Corgi has its own personality, denoted by $$$p_i$$$. You've noticed that the happiness of a pair of Corgis is represent by the bitwise AND of their personalities. Furthermore, a group of Corgis as a total happiness equal to the sum of happiness over all unordered pairs of distinct Corgis. Being enjoyers of counting, the Corgis want to know the sum of happiness over all possible groups they could form amongst themselves. Please help the Corgis by finding this value. Since this value can be enormous, output it modulo $$$998244353$$$.
Formally, you are given $$$n$$$ integers $$$p_1, p_2, \dots, p_n$$$. ($$$1 \leq n \leq 2 \cdot 10^5, 0 \leq p_i \lt 2^{22}$$$). For some subset $$$S$$$ of the permutation $$$1, \dots, n$$$, let $$$f(S)$$$ be defined as follows:
$$$$$$f(S) = \sum_{i,j \in S, i \lt j} p_i \& p_j$$$$$$
You must output the sum of $$$f(S)$$$ over all $$$2^n$$$ subsets $$$S$$$, modulo $$$998244353$$$.
The first line of input will contain an integer $$$n$$$, denoting the number of Corgis. ($$$1 \leq n \leq 2 \cdot 10^5$$$) The second line will contain $$$n$$$ space-separated integers $$$p_1 ... p_n$$$, denoting the personalities of the $$$n$$$ Corgis. ($$$0 \leq p_i \lt 2^{22}$$$)
Output the sum of the sum of the bitwise AND of personalities over all unordered pairs of distinct Corgis, for all $$$2^n$$$ subsets of Corgis, modulo $$$998244353$$$.
31 2 3
6
53 5 2 1 2
72
673283 92928 9211 299 22999 39333
1912096
| Название |
|---|


