摘要:
jzoj snow的追寻 DFS序上搞 合并暴力和,记录最长链和当前最远点,距离跑LCA # include <stdio.h> # include <stdlib.h> # include <iostream> # include <algorithm> # include <string.h> 阅读全文
摘要:
斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register 阅读全文
摘要:
斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register 阅读全文
摘要:
斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define Sqr(x) (1LL * (x) * (x)) # defi 阅读全文
摘要:
斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register 阅读全文
摘要:
斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define Sqr(x) (1LL * (x) * (x)) # defi 阅读全文
摘要:
分段矩乘即可 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # define ll long long # define RG register # define IL inlin 阅读全文
摘要:
左偏树加lazy操作即可 # include <stdio.h> # include <stdlib.h> # include <string.h> # include <iostream> # include <algorithm> # define ll long long # define R 阅读全文
摘要:
新建一个优先队列,将源点s加入到队列中; 从优先级队列中弹出f(p)最小的点p,如果点p就是t,则计算t出队的次数; 如果当前为t的第k次出队,则当前路径的长度就是s到t的第k短路的长度,算法结束; 否则遍历与p相连的所有的边,将扩展出的到p的邻接点信息加入到优先级队列 # include <ios 阅读全文
摘要:
。。。 和Kruskal生成树一样 本来是u,v连一条f的边 现在变成新建一个点,点权为f,u v都像它连无边权的边 (实际上应该是u的根和v的根) 这样树有一些性质: 1.二叉树 2.原树与新树两点间路径上边权(点权)的最大(最小)值相等 3.子节点的边权(大于等于)小于等于父亲节点 4.原树中两 阅读全文