dfs序
Gee_Zer
这个作者很懒,什么都没留下…
展开
-
HDU - 3887 Counting Offspring(dfs序+主席树)
Problem Description You are given a tree, it’s root is p, and the node is numbered from 1 to n. Now define f(i) as the number of nodes whose number is less than i in all the succeeding nodes of node i...原创 2019-07-25 17:03:22 · 130 阅读 · 0 评论 -
CF620 E. New Year Tree(DFS序+状态压缩+线段树)
题目链接:CF620E 题意: 给你一颗n个节点的树,每个节点被染上了颜色,然后就是m次查询。 查询的方式有两种 1,将以z为根的子树的结点全部更新为颜色X 2,问以z为根的子树的结点的不同颜色数量。默认根为1 Input 第一行输入n,m(4*10^5) 第二行 输入每个节点的颜色(n个) 颜色X<=60 接下来n-1行就是两个点相连 最后m行查询 其中 1 z X 代表操作1, 2 x ...原创 2019-07-27 16:46:42 · 212 阅读 · 0 评论