忘记里给改过的字符替换掉 自己没有想到两个端点如果中间容纳不下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
延伸阅读
- 2011-12-29-- ios2011,2011年度国内10佳iOS应用
- 2011-12-29-- qq2011,Gamasutra: 2011年最佳手机游戏
- 2011-12-30-- qq2011,2011最成功的中国IT企业排行榜
- 2011-9-1-- qq2011,2011电商界十大给力看点
- 2011-9-22-- 2011快女落幕,2011百度“Web App创新大赛”圆满落幕 150万现金奖励应用创新
- 2011-9-1-- qq2011,百度世界2011,开启一场全行业盛宴
- 2011-1-16-- 2011大牛市,李晶:流动性泛滥 奠定2011年商品市场牛市根基
- 2011-9-15-- qq2011,2011年互联网工作者必上的20个网站推荐
- 2011-1-4-- adworld,Adworld2011互动营销世界1月7日开幕
- 2011-1-16-- 2011大牛市,李晶:流动性泛滥 奠定2011年商品市场牛市根基
最新评论