随笔分类 - 动态规划-树形动规
摘要:虚树dp 虚树的主要思想: 不遍历没用的的节点以及没用的子树,从而使复杂度降低到$\sum\limits k$(k为询问的节点的总数)。 所以怎么办: 只把询问节点和其LCA放入询问的数组中。 1、建虚树 cpp long long getmin(int x,int lca){ int ret=1e
阅读全文
摘要:You are given an undirected tree consisting of $n$ vertices. An undirected tree is a connected undirected graph with $n−1$ edges. Your task is to add
阅读全文
浙公网安备 33010602011771号