随笔分类 - 树(杂谈)
摘要:给出了一个序列,你需要处理如下两种询问。 "C a b c"表示给[a, b]区间中的值全部增加c (-10000 ≤ c ≤ 10000)。 "Q a b" 询问[a, b]区间中所有值的和。 Input 第一行包含两个整数N, Q。1 ≤ N,Q ≤ 100000. 第二行包含n个整数,表示初始的序列A (-1000000000 ≤ Ai ≤ 1000000000)。 接下来Q行询问, ...
阅读全文
摘要:线段树的单点更新+区间求和 hdu1166敌兵布阵 Input 第一行一个整数T,表示有T组数据。 每组数据第一行一个正整数N(N #include #include #include using namespace std; const int maxn=50005; int num[maxn]; char str[30]; int n; typedef struct node{ int...
阅读全文
摘要:D - Jungle Roads Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1251 D - Jungle Roads Submit Status P
阅读全文
摘要:B - 畅通工程再续 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1875 B - 畅通工程再续 Submit Status Practice HDU
阅读全文
摘要:参考链接: http://blog.csdn.net/acm_cxlove/article/details/8565309 http://www.cnblogs.com/Rlemon/archive/2013/05/24/3096264.html http://seter.is-programmer
阅读全文
摘要:The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest num
阅读全文
摘要:SPOJ 10628. Count on a tree (树上第k大,LCA+主席树) 10628. Count on a tree Problem code: COT You are given a tree with N nodes.The tree nodes are numbered fro
阅读全文
摘要:D-query Time Limit: 227MS Memory Limit: 1572864KB 64bit IO Format: %lld & %llu Submit Status Description English Vietnamese Given a sequence of n numb
阅读全文
摘要:K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 43315 Accepted: 14296 Case Time Limit: 2000MS Description You are working for
阅读全文
摘要:Super Mario Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3625 Accepted Submission(s): 1660 Pro
阅读全文
摘要:The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1091 Accepted Submis
阅读全文
摘要:此代码同hdu2665改编#include #include #include #include using namespace std; #define N 100500 #define MID ((l+r)>>1) int a[N],s[N],t[20][N],num[20][N],n,m; void Build(int c,int l,int r) { int lm=M...
阅读全文
摘要:Kth number Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6951 Accepted Submission(s): 2214 Pro
阅读全文
摘要:Elven PostmanTime Limit: 1500/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 800Accepted Submission(s): 429Probl...
阅读全文
摘要:Cow MarathonTime Limit: 2000MSMemory Limit: 30000KTotal Submissions: 4216Accepted: 2137Case Time Limit: 1000MSDescriptionAfter hearing about the epide...
阅读全文
摘要:一、哈夫曼树的概念和定义 什么是哈夫曼树? 让我们先举一个例子。 判定树: 在很多问题的处理过程中,需要进行大量的条件判断,这些判断结构的设计直接影响着程序的执行效率。例如,编制一个程序,将百分制转换成五个等级输出。大家可能认为这个程序很简单,并且很快就可以用下列形式编写出来: [cpp] view
阅读全文
摘要:E - Encoded Barcodes Crawling in process...Crawling failedTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu SubmitStatusPracticeUVALive 5
阅读全文
摘要:Problem Description For a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation. Given a com
阅读全文
摘要:欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Ping pong Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4589 A
阅读全文
摘要:Binary Tree TraversalsTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4330Accepted Submission(s): ...
阅读全文