HdU 4046 Panda 段树】的更多相关文章

链接: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): 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…
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…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4046 When I wrote down this letter, you may have been on the airplane to U.S. We have known for 15 years, which has exceeded one-fifth of my whole life. I still remember the first time we went to the mov…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4046   题意:给出一个字符串,统计这个字符串任意区间中"wbw"出现的次数. 规定两种操作,一是查询任意区间"wbw"出现次数:二是修改某一位置的字符.   分析:比较明显的线段树,单点更新,区间查询. 线段树记录的信息是区间中出现"wbw"字符的个数,线段树的叶子节点[i,i]记录字符串str中 str[i-2][i-1][i]是否是"wb…
线段树单点更新,要注意两段合并多出的答案的计算即可 //============================================================================ // Name : D.cpp // Author : L_Ecry // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //==========…
好久没写过博客了,这学期不是很有热情去写博客,写过的题也懒得写题解.现在来水一水博客,写一下若干年前的题目的题解. Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21978    Accepted Submission(s): 8714 Problem Description There are several anc…
Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6386    Accepted Submission(s): 2814 Problem Description There are several ancient Greek texts that contain descriptions of the fabled i…
意甲冠军: 特定n, 下面是一个1-n该装置. 下面的二进制字符串. 按给定的建立二叉树安排. 然后遍历树(根->左子树->根->右子树->根) 当遍历节点 如果右值为奇数入栈一个1,若为偶数入栈一个0 得到一个母串. 问母串中出现了几次子串. 思路: 先是建树得到母串.然后求子串个数就是裸的KMP. 建树就是找个规律,然后用线段树维护一下输入的排列 #include <cstdio> #include <cstring> #include <iost…