Home » Practice(Hard) » Observing the Tree https://www.codechef.com/problems/QUERY Observing the Tree Problem Code: QUERY Submit Tweet All submissions for this problem are available. Chef gives you a tree, consisting of N nodes. The nodes are numbe…
Codechef Union on Tree https://www.codechef.com/problems/BTREE 简要题意: 给你一棵树,\(Q\)次询问,每次给出一个点集和每个点的\(r_i\),每个点可以覆盖距离小于等于\(r_i\)的点. 问有多少点会被覆盖. 分析: 建出虚树,然后我们做两边\(dp\)把所有点的\(r_i\)更新成从这个点能覆盖的最远距离或从其他点出来经过这个点后能够覆盖的最远距离. 这样做的好处是对于一条边\((x,y)\),一定存在一个点\(z\),…