問題一覧 > 通常問題

No.1189 Sum is XOR

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 127
作問者 : Ebishu / テスター : Rho
お気に入りにしたユーザー ProblemId : 4874 / 自分の提出
問題文最終更新日: 2020-12-02 16:59:59
Sum is XOR
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. Show the original
技術室奥プログラミングコンテスト#5 Day1 (順位表) の他の問題:

Problem Statement

 You are given a sequence $A$ of $N$ positive integers.

Find the number of sequences $B$ of length $K$ that satisfy the following conditions. If no sequence satisfies the conditions, the count is $0$.

  • $1\leq B_1< B_2<\cdots< B_K\leq N$
  • $A_{B_1}+A_{B_2}+\cdots+A_{B_K}=A_{B_1}\ xor\ A_{B_2}\ xor\ \cdots\ xor\ A_{B_K}$
Here, for positive integers $a, b$, $a\ xor\ b$ denotes the bitwise exclusive OR of $a$ and $b$.

 Since the answer can be very large, output it modulo $998244353$.

Input

$N\ K$
$A_1\ A_2\ \cdots\ A_N$
  • All inputs are integers.
  • $2\leq N\leq 2\times10^5$
  • $2\leq K\leq N$
  • $1\leq A_i\leq 2^{10}-1\ (1\leq i\leq N)$

Output

Output the answer modulo $998244353$, followed by a newline.

Sample

Sample 1
Input
3 2
1 2 5
Output
2

  • $A_1+A_2=A_1\ xor\ A_2=3$ and $1\leq 1< 2 \leq 3$, so the sequence $(1,2)$ satisfies the conditions.
  • $A_2+A_3=A_2\ xor\ A_3=7$ and $1\leq 2< 3 \leq 3$, so the sequence $(2,3)$ satisfies the conditions.
No other sequence satisfies the conditions, so output $2$.

Sample 2
Input
2 2
1 2
Output
1

  • $A_1+A_2=A_1\ xor\ A_2=3$ and $1\leq 1< 2 \leq 2$, so the sequence $(1,2)$ satisfies the conditions.
No other sequence satisfies the conditions, so output $1$.

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