
数据结构
m悟空
这个作者很懒,什么都没留下…
展开
-
Defending Plan Support (树的边 乘 权值 和最小)
题目描述The architectural structure of the college is strange, but the rule is that there is only one simple path between every two classrooms. Now the battle between Class A and Class F broke out. As a...原创 2019-04-12 10:00:05 · 435 阅读 · 0 评论 -
点的距离 (倍增求LCA)
题目描述给定一棵 n个点的树,m 个询问,每次询问点 x到点 y两点之间的距离。输入格式第一行一个正整数,表示这棵树有 n 个节点;接下来 n - 1 行,每行两个整数 x,y 表示 x,y 之间有一条连边;然后一个整数 m,表示有 m 个询问;接下来 m 行每行两个整数 x,y 表示询问 x 到 y 的距离。输出格式输出 一行,每行表示每个询问的答案。样...原创 2019-04-16 18:51:46 · 676 阅读 · 0 评论 -
Max answer (求区间最小值乘区间和的最大结果,维护左右区间+st求区间最大,最小值)
Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval.Now she is planning to find the...原创 2019-04-21 15:09:09 · 3047 阅读 · 0 评论 -
Clock Pictures(KMP 给了两个指针个数一样时钟,旋转其中一个是否能得到另一个)
You have two pictures of an unusual kind of clock. The clock has n hands, each having the same length and no kind of marking whatsoever. Also, the numbers on the clock are so faded that you can’t e...原创 2019-04-17 09:45:03 · 547 阅读 · 0 评论 -
大小接近的点对 (树状数组 + 离散化)
题目描述一天,Chika 对大小接近的点对产生了兴趣,她想搞明白这个问题的树上版本,你能帮助她吗?Chika 会给 你一棵有根树,这棵树有 n 个结点,被编号为 1 n,1 号结点是根。每个点有一个权值,i 号结点的权值为 a[i]。如果 u 是 v 的祖先结点,并且 abs(a[u]−a[v]) ≤K,那么 (u,v) 被称作一个“** 大小接近的点对 **”。 对于树上的每个结点 i,你都...原创 2019-04-17 13:45:19 · 279 阅读 · 0 评论 -
Robots (遍历树处理 ,分治)
The Robotics Olympiad teams were competing in a contest.There was a tree drawn on the floor, consisting ofnnodes andn - 1edges. The nodes are numbered from1ton, and each edge has a weight. Th...原创 2019-04-24 18:01:08 · 300 阅读 · 0 评论 -
Aragorn's Story(树链剖分+线段树或树状数组模板)
Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn knows, the enemy has N camps ou...原创 2019-05-28 21:51:32 · 988 阅读 · 0 评论 -
求和问题(线段树维护等差数列)
题目描述你现在有一个数组AA我们定义如下的两种操作:1. 修改: 形如00llrr,效果为对所有l<=i<=rl<=i<=r执行Ai+=(i−l+1)Ai+=(i−l+1)直观地说就是Al+=1,Al+1+=2,Al+2+=3...Ar+=r−l+1Al+=1,Al+1+=2,Al+2+=3...Ar+=r−l+1这个样子2. ...原创 2019-08-02 22:41:57 · 626 阅读 · 0 评论