随笔分类 - 线段树
摘要:Dylans loves tree
阅读全文
摘要:Brakerts 每次询问一个区间都根据最开始的线段树在询问的区间重建一棵线段树 view code#include #include #include #include #define lson l,m,rt using namespace std; typedef long long LL; const int N = 200010; int _, n, Q; char s...
阅读全文
摘要:view code//第二道持久化线段树,照着别人的代码慢慢敲,还是有点不理解
#include #include #include #include #include using namespace std;
typedef long long ll;
#define lson l,m,ls[rt]
#define rson m+1,r,rs[rt]
const int N = 200...
阅读全文
摘要:K-th Number持久化:http://www.cnblogs.com/tedzhao/archive/2008/11/12/1332112.html结构:http://www.docin.com/p-627462377.html 1 #include 2 #include 3 #inclu...
阅读全文
摘要:hdu 4967 Handling the Past view code//把时间离散化,维护一个线段(线段l到r的和用sum[l,r]表示),pop的时候就在对应的时间减一,push则相反
//那么每次peak的时候(假设在pk是时刻),找一个以pk为结尾的后缀和,这个后缀和为1且前端离pk最近。
//即sum[pu, pk]==1 且pu是最靠近pk的时间。
//理解:假设sum[l,pk]=...
阅读全文
摘要:poj 3237 tree inline : 1. inline 定义的类的内联函数,函数的代码被放入符号表中,在使用时直接进行替换,(像宏一样展开),没有了调用的开销,效率也很高。 2. 很明显,类的内联函数也是一个真正的函数,编译器在调用一个内联函数时,会首先检查它的参数的类型,保证调用正确。然
阅读全文
摘要:The Subtle Balloons Company (SBC) is the main balloon provider for programming contests; it hashuge factories and warehouses, as well as an extensive
阅读全文
摘要:题意:输入n, m ; 有n给位置, 初始时第i个位置的color为i, colorfulness为0。 有m次操作,一种是把成段的区域color更新为x, 对于更新的区域,每个位置(令第i个位置未更新前颜色为color[i])的colorfulness增加|color[i] -x|; 另一种操作是询问一段区间[L,R]输出该区间的colorfulness总和。 代...
阅读全文
摘要:Hotel Time Limit: 3000MSMemory Limit: 65536K Total Submissions: 10858Accepted: 4691 Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation ...
阅读全文
摘要:Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6116 Accepted Submission(s): 2677 Problem Description There are several anc...
阅读全文
摘要:Count Color Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 33311 Accepted: 10058 Description Chosen Problem Solving and Program design as an optional course, you are required to ...
阅读全文
摘要:Sliding Window Time Limit: 12000MSMemory Limit: 65536K Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very l...
阅读全文
摘要:Ultra-QuickSort Time Limit: 7000MS Memory Limit: 65536K Description In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers...
阅读全文
摘要:Problem 1608 Huge MissionTime Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionOaiei is busy working with his graduation design recently. I...
阅读全文
摘要:Mayor's postersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 37346Accepted: 10864DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has fi
阅读全文
摘要:A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 53169 Accepted: 15897Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in...
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34484 Accepted Submission(s): 14660 Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每...
阅读全文
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 30900 Accepted Submission(s): 12276 Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组...
阅读全文

浙公网安备 33010602011771号