HDU—4046 Panda (线段树)】的更多相关文章

Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2565    Accepted Submission(s): 861 Problem Description When I wrote down this letter, you may have been on the airplane to U.S. We have kn…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4046 意甲冠军:到了bw组成的长度为n的字符串(n<=50000).有m次操作(m<=10000),每次操作是询问一段范围内wbw的个数.或者改变一个字符成为w或b. 思路:建一棵线段树,每一个结点记录的是从L到R以每一个i为最左边的字母的总共的wbw的个数,单点更新的时候要更新三个点. 代码: #include <iostream> #include <cstdio> #in…
Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2838    Accepted Submission(s): 945 Problem Description When I wrote down this letter, you may have been on the airplane to U.S.  We have…
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1816    Accepted Submission(s): 632 Problem Description When I wrote down this letter, you may have…
Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2496    Accepted Submission(s): 788 Problem Description Today is the 10th Annual of “September 11 attacks”, the Al Qaeda is about to attack…
Coder Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4838    Accepted Submission(s): 1853 Problem Description In mathematics and computer science, an algorithm describes a set of procedures…
Man Down Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2030    Accepted Submission(s): 743 Problem Description The Game “Man Down 100 floors” is an famous and interesting game.You can enjoy t…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4046   题意:给出一个字符串,统计这个字符串任意区间中"wbw"出现的次数. 规定两种操作,一是查询任意区间"wbw"出现次数:二是修改某一位置的字符.   分析:比较明显的线段树,单点更新,区间查询. 线段树记录的信息是区间中出现"wbw"字符的个数,线段树的叶子节点[i,i]记录字符串str中 str[i-2][i-1][i]是否是"wb…
1.HDU 5877  Weak Pair 2.总结:有多种做法,这里写了dfs+线段树(或+树状树组),还可用主席树或平衡树,但还不会这两个 3.思路:利用dfs遍历子节点,同时对于每个子节点au,查询它有多少个祖先av满足av<=k/au. (1)dfs+线段树 #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<algorithm>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3308 题目很好懂,就是单点更新,然后求区间的最长上升子序列. 线段树区间合并问题,注意合并的条件是a[mid + 1] > a[mid],写的细心点就好了. #include <iostream> #include <cstring> #include <cstdio> using namespace std; ; struct SegTree { int l , r…