QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#839. 忽略子遮罩

الإحصائيات

給定一個包含 $n$ 個整數的陣列 $a_1, a_2, \dots, a_n$。每個整數都在 $0$ 到 $2^k - 1$ 之間(包含邊界)。

定義 $f(x)$ 為滿足 $(a_i \& x) = a_i$ 的最小索引 $i$(從 $1$ 開始計數),若不存在這樣的 $i$,則 $f(x) = 0$。其中 $(a \& b)$ 為位元 AND 運算。

請求出 $f(0) + f(1) + \dots + f(2^k - 1)$ 的值。由於此數值可能非常大,請輸出其對 $998\,244\,353$ 取模後的結果。

輸入格式

第一行包含兩個整數:$n, k$ ($1 \le n \le 100, 1 \le k \le 60$)。

第二行包含 $n$ 個整數:$a_1, a_2, \dots, a_n$ ($0 \le a_i < 2^k$)。

輸出格式

輸出一個整數:$f(0) + f(1) + \dots + f(2^k - 1)$ 對 $998\,244\,353$ 取模後的結果。

範例

範例輸入 1

2 1
0 1

範例輸出 1

2

範例輸入 2

2 2
2 1

範例輸出 2

4

範例輸入 3

5 10
389 144 883 761 556

範例輸出 3

1118

說明

在第一個範例中,$f(0) = 2, f(1) = 0$。

在第二個範例中,$f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 0$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.