随笔分类 - 线段树
摘要:线段树属于二叉树, 其核心特征就是支持区间加法,这样就可以把任意待查询的区间$[L, R]$分解到线段树的节点上去,再把这些节点的信息合并起来从而得到区间$[L,R]$的信息。 下面证明在线段树上查询任意区间的复杂度是$O(\log{N})$的,$N$是区间总长度。 由于访问一个节点(即获得一个节点
阅读全文
摘要:Solution $F(L, R)$ 就是在 $A[L]$ 在 $[L+1, R]$ 内从左模到右。 首先应当注意到: 对 $a, b \in N^*$ \[a \bmod b \begin{cases} = a, && b>a;\\ < \lceil \frac{a}{2} \rceil, &&
阅读全文
摘要:传送门 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Microsoft interviewer is in the room though the do
阅读全文
摘要:传送门 时间限制:10000ms 单点时限:5000ms 内存限制:256MB 时间限制:10000ms 单点时限:5000ms 内存限制:256MB 描述 你正在和小冰玩一个猜数字的游戏。小冰首先生成一个长为N的整数序列 $A_1, A_2, \dots , A_N$。在每一轮游戏中,小冰会给出一
阅读全文
摘要:传送门D. Sum of Medianstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn one well-known algorithm ...
阅读全文
摘要:【一更】2015/4/5线段树是『维护区间』的数据结构,它能高效计算一个关于区间的函数 『F([a, b])』,计算方法是对区间进行『分治』。题目_________1.『RMQ』传送门_________假设整个货架上从左到右摆放了N种商品,并且依次标号为1到N,每次小Hi都给出一段区间[L, R],
阅读全文
摘要:传送门A. Greg and Arraytime limit per test 1.5 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputGreg has an arr...
阅读全文

浙公网安备 33010602011771号