Fantasy magicians usually gain their ability through one of three usual methods: possessing it as an innate talent, gaining it through study and practice, or receiving it from another being, often a god, spirit, or demon of some sort. Some wizards ar…
Sample Input 3 0 0 0 3 0 1 5 0 1 0 0 1 1 0 1 0 0   Sample Output Case #1: 0 0 0 Case #2: 0 1 0 2 有0,1两个操作,0  x代表添加从x 到 x + i(带表第i次添加)的线段,每次添加时问被其覆盖的线段有多少. 1  x代表删除第i次添加的. 思路:每一次添加后,求出小于x的左节点个数x1,小于等于y的右节点个数x2. x2- x1即可 改变单个节点,所以树状数组更加合适 #include<iost…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 593    Accepted Submission(s): 164 Problem Description There are n circles on a infinitely large table.With every two circle, either one contains…
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 38    Accepted Submission(s): 10 Problem Description Alice is so popular that she can receive many flowers everyday. She has N v…
题意摘自:http://blog.csdn.net/kdqzzxxcc/article/details/9474169 ORZZ 题意:给你N个花瓶,编号是0 到 N - 1 ,初始状态花瓶是空的,每个花瓶最多插一朵花. 然后有2个操作. 操作1,a b c ,往在a位置后面(包括a)插b朵花,输出插入的首位置和末位置. 操作2,a b ,输出区间[a , b ]范围内的花的数量,然后全部清空. 很显然这是一道线段树.区间更新,区间求和,这些基本的操作线段树都可以logN的时间范围内完成. 操作…
HDU6602 Longest Subarray 线段树 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6602 题意: 给你一段区间,让你求最长的区间使得区间出现的数字的个数大于k 题解: 比较巧妙的的线段树更新的做法 我们选择的区间吗,该区间内出现的数字的个数必须要满足条件 我们转换一下,我们以当前点为右端点,往左找一个满足条件的左端点,即可更新答案 我们将每个点给予一个权值C-1,更新这个点的数字上次出现的位置之前到现在这个位置-1的一段减1…
Crazy Bobo Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 1215    Accepted Submission(s): 366 Problem Description Bobo has a tree,whose vertices are conveniently labeled by 1,2,...,n.Each nod…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1371    Accepted Submission(s): 448 Problem Description There are n apple trees planted along a cyclic road, which is L metres…
Virtual Participation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 237    Accepted Submission(s): 56 Special Judge Problem Description As we know, Rikka is poor at math. Yuta is worrying abo…
Connect the Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 108    Accepted Submission(s): 36 Special Judge Problem Description Once there was a special graph. This graph had n vertices a…