QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 64 MB مجموع النقاط: 100 قابلة للهجوم ✓

#7193. 你从未听说过的数据结构

الإحصائيات

Bobo 拥有一个包含 $n$ 个 $d$ 维二进制向量的序列 $a_1, a_2, \dots, a_n$,他想要求出非降子序列的数量,结果对 $(10^9 + 7)$ 取模。

形式化地,序列 $a$ 的一个非降子序列是一个序列 $(i_1, i_2, \dots, i_k)$,满足 $i_1 < i_2 < \dots < i_k$ 且 $a_{i_1} \le a_{i_2} \le \dots \le a_{i_k}$。对于两个 $d$ 维二进制向量 $u = (u_1, u_2, \dots, u_d)$ 和 $v = (v_1, v_2, \dots, v_d)$,当且仅当对于所有 $1 \le i \le d$ 都有 $u_i \le v_i$ 时,称 $u \le v$。

输入格式

第一行包含两个整数 $n$ 和 $d$ ($1 \le n \le 2 \times 10^5, 1 \le d \le 16$)。

接下来的 $n$ 行中,第 $i$ 行包含一个长度为 $d$ 的字符串,表示向量 $a_i$ 的 $d$ 个分量。

输出格式

输出一个整数,表示非降子序列的数量对 $(10^9 + 7)$ 取模的结果。

样例

输入格式 1

3 2
00
00
11

输出格式 1

7

输入格式 2

4 3
110
100
011
101

输出格式 2

5

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.