摘要: https://codeforces.com/contest/1923/problem/E 这一道题有三种不一样的写法,有一种是用启发式合并(跟树上没啥关系)去优化dp的做法。 int n, k; int c[200005]; vector<int> G[200005]; ll ans; map<i 阅读全文
posted @ 2021-03-16 18:33 purinliang 阅读(86) 评论(0) 推荐(0) 编辑
摘要: CF375D - Tree and Queries 题意:给定一棵 \(n(2\leq n\leq 10^5)\) 个结点的树,根结点为 \(1\) 号结点,每个结点有颜色 \(c(\leq c\leq 10^5)\) 。然后 \(m(1\leq m\leq 10^5)\) 次询问,每次询问给两个参 阅读全文
posted @ 2021-03-16 17:27 purinliang 阅读(185) 评论(0) 推荐(0) 编辑