qq2011,2011北京网络赛G

忘记里给改过的字符替换掉 自己没有想到两个端点如果中间容纳不下3个字符的时候输出0 后来看了别人的代码 改过这两处才对
G Panda
Description
When I wrote down this letter, you may have been _disibledevent=> For each test case:
First line is two integers n, m
n means the length of the letter, m means the query of the Panda. n<=50000,m<=10000
The next line has n characters 'b' or 'w', 'b' means black, 'w' means white.
The next m lines
Each line has two type
Type 0: answer how many love between L and R. (0<=L<=R Type 1: change the kth character to ch(0<=k Output
For each test case, output the case number first.
The answer of the question.
Sample Input
2
5 2
bwbwb
0 0 4
0 1 3
5 5
wbwbw
0 0 4
0 0 2
0 2 4
1 2 b
0 0 4
Sample Output
Case 1:
1
1
Case 2:
2
1
1
0
#include #include #include using namespace std; int n; int a[50001]; void add(int x,int y)//改变下表为x的元素的值 会导致所有x的父节点的值的改变 { for(;x<=n;x+=x&-x) a[x]+=y; } int sum1(int x) { int ans=0; for(;x>0;x-=x&-x) { ans+=a[x]; } return ans; } int main() { int m; char str[50001]; int t; cin>>t; for(int ll=1;ll<=t;ll++) { scanf("%d %d",&n,&m); scanf("%s",str+1); memset(a,0,sizeof(a)); for(int i=2;i
Tags:  2011北京网络 2011快女 2011快女冠军 2011快乐女声 qq2011

延伸阅读

最新评论

发表评论