当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6155:Subsequence Count

题目描述
Given a binary string $S[1,...,N]$ (i.e. a sequence of 0's and 1's), and $Q$ queries on the string.

There are two types of queries:

1. Flipping the bits (i.e., changing all 1 to 0 and 0 to 1) between $l$ and $r$ (inclusive).
2. Counting the number of distinct subsequences in the substring $S[l,...,r]$.
输入解释
The first line contains an integer $T$, denoting the number of the test cases.

For each test, the first line contains two integers $N$ and $Q$.

The second line contains the string $S$.

Then $Q$ lines follow, each with three integers $type$, $l$ and $r$, denoting the queries.

$1\leq T\leq 5$

$1\leq N, Q\leq 10^5$

$S[i]\in \lbrace 0, 1 \rbrace, \forall 1\leq i\leq N$

$type\in \lbrace 1, 2 \rbrace$

$1\leq l \leq r\leq N$
输出解释
For each query of type 2, output the answer mod ($10^9+7$) in one line.
输入样例
2
4 4
1010
2 1 4
2 2 4
1 2 3
2 1 4
4 4
0000
1 1 2
1 2 3
1 3 4
2 1 4
输出样例
11
6
8
10
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6155

最后修改于 2020-10-25T23:28:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 256000/256000K(Java/Others)