問題一覧 > 通常問題

No.2344 (l+r)^2

レベル : / AI推定難易度 : 2350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 39
作問者 : ytqm3 / テスター : ぷら keisuke6
お気に入りにしたユーザー ProblemId : 9501 / 自分の提出
問題文最終更新日: 2023-09-23 14:58:17
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 392 (順位表) の他の問題:

Problem Statement

Solve the following problem for $T$ test cases.

You are given an integer sequence $A$ of length $N$. Define $b_{i,j}$ as follows.

  • $b_{1,j}:=A_j$ $(1 \le j \le N)$
  • $b_{i,j}:=(b_{i-1,j}+b_{i-1,j+1})^2$ $(2 \le i \le N$ and $1 \le j \le N+1-i)$

Find $b_{N,1} \bmod 2^M$.

Input

$T$
$\text{case}_1$
$\text{case}_2$
$\vdots$
$\text{case}_T$

Each case is given in the following format.

$N$ $M$
$A_1$ $A_2$ $\ldots$ $A_N$
  • $1 \le T \le 2 \times 10^5$
  • $1 \le N \le 2 \times 10^5$
  • $1 \le M \le 30$
  • $0 \le A_i < 2^M$
  • The sum of $N$ over all cases does not exceed $2\times 10^5$.
  • All input values are integers.

Output

Print $T$ lines. The $i$-th line should contain the answer for $\text{case}_i$.

Sample

Sample 1
Input
3
3 4
3 3 4
2 30
10 10
7 5
31 25 6 28 14 29 22
Output
9
400
17

For the $1$st case: $b_{3,1}$ is $(36+49)^2=7225$, so the answer is $7225 \bmod 16 = 9$.

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