問題一覧 > 通常問題

No.641 Team Contest Estimation

レベル : / AI推定難易度 : 1400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 23
作問者 : square1001 / テスター : 夕叢霧香(ゆうむらきりか)
お気に入りにしたユーザー ProblemId : 1995 / 自分の提出
問題文最終更新日: 2026-06-26 18:42:06
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 181 (順位表) の他の問題:

Problem Statement

A team consisting of $N$ players solves a certain problem. The players are numbered $1, 2, 3, \dots, N$, and the rating of player $i$ is $A_i$.
This team can solve a problem of difficulty $x$ in time $(A_1 \ XOR \ x) + (A_2 \ XOR \ x) + (A_3 \ XOR \ x) + \cdots + (A_N \ XOR \ x)$.
The difficulty is known to be an integer between $0$ and $2^K-1$, inclusive. Assuming that it is chosen uniformly at random, write a program that finds the mean $\mu$ and the standard deviation $\sigma$ of the time the team takes to solve this problem.
However, since $\mu$ and $\sigma$ are not integers, output instead $\mu 2^K$ and $\sigma ^2 4^K$, each modulo $1,000,000,009$.

Input

$N$ $K$
$A_1 \ A_2 \ A_3 \ \cdots \ A_N$

The $1$st line contains the integers $N$ and $K$, separated by a space.
The $2$nd line contains the integers $A_1, A_2, A_3, \dots, A_N$, separated by spaces.

Output

On the $1$st line, output $\mu 2^K$ modulo $1,000,000,009$.
On the $2$nd line, output $\sigma^2 4^K$ modulo $1,000,000,009$.

Constraints

All input data satisfy the following conditions.

  • $1 \le N \le 100 \ 000$.
  • $0 \le K \le 60$.
  • $0 \le A_i \le 2^K-1 \ (1 \le i \le N)$.

Sample

Sample 1
Input
3 2
1 2 3
Output
18
20
  • When $x = 0$, the team takes $(1 \ XOR \ 0) + (2 \ XOR \ 0) + (3 \ XOR \ 0) = 1 + 2 + 3 = 6$ units of time to solve the problem.
  • When $x = 1$, the team takes $(1 \ XOR \ 1) + (2 \ XOR \ 1) + (3 \ XOR \ 1) = 0 + 3 + 2 = 5$ units of time to solve the problem.
  • When $x = 2$, the team takes $(1 \ XOR \ 2) + (2 \ XOR \ 2) + (3 \ XOR \ 2) = 3 + 0 + 1 = 4$ units of time to solve the problem.
  • When $x = 3$, the team takes $(1 \ XOR \ 3) + (2 \ XOR \ 3) + (3 \ XOR \ 3) = 2 + 1 + 0 = 3$ units of time to solve the problem.

Then the mean is $\mu = (6 + 5 + 4 + 3) \div 4 = 4.5$, so $\mu 2^K = 4.5 \times 4 = 18$.

Also, the standard deviation is $\sigma = \sqrt{((6 - \mu)^2 + (5 - \mu)^2 + (4 - \mu)^2 + (3 - \mu)^2) \div 4} = \sqrt{1.25}$. Therefore, $\sigma^2 4^K = \sqrt{1.25}^2 \times 16 = 20$.

Sample 2
Input
10 3
1 4 1 4 2 1 3 5 6 2
Output
280
1280

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。