Subsequence Count
来源:互联网 发布:淘宝上的台式机 编辑:程序博客网 时间:2024/06/05 05:59
Subsequence Count
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
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) betweenl and r (inclusive).
2. Counting the number of distinct subsequences in the substringS[l,...,r] .
There are two types of queries:
1. Flipping the bits (i.e., changing all 1 to 0 and 0 to 1) between
2. Counting the number of distinct subsequences in the substring
Input
The first line contains an integer T , denoting the number of the test cases.
For each test, the first line contains two integersN and Q .
The second line contains the stringS .
ThenQ lines follow, each with three integers type ,l and r , denoting the queries.
1≤T≤5
1≤N,Q≤105
S[i]∈{0,1},∀1≤i≤N
type∈{1,2}
1≤l≤r≤N
For each test, the first line contains two integers
The second line contains the string
Then
Output
For each query of type 2, output the answer mod (109+7 ) in one line.
Sample Input
24 410102 1 42 2 41 2 32 1 44 400001 1 21 2 31 3 42 1 4
Sample Output
116810
阅读全文
0 1
- Subsequence Count
- [HDU 6155] Subsequence Count
- HDU 6155 Subsequence Count
- HDU 6155 Subsequence Count(线段树 dp)
- HDU 6155 Subsequence Count [线段树维护矩阵]
- hdu6155-Subsequence Count(线段树+矩阵+dp)
- HDU 6155 Subsequence Count dp + 矩阵+ 线段树
- Hdu 6155 Subsequence Count 矩阵计算DP+线段树维护
- Subsequence
- Subsequence
- Subsequence
- subsequence
- Subsequence
- Subsequence
- Subsequence
- Subsequence
- Subsequence
- Subsequence
- CaoHaha's staff
- 二叉树排序(前序、中序、后序)
- tensorflow gpu 0.12.1 版本与python对应关系及下载地址
- 第二十天总结
- 多线程快速入门
- Subsequence Count
- (二)SSM中mybatis一对一查询
- 服务器开发之简单的TCP回射服务器(0):程序说明
- Palindrome Function
- instanceof的使用: 对象与构造函数在原型链上是否有关系
- 交换排序-冒泡排序
- The Karting
- hdu2955(01背包)
- The Designer