摘要: "传送门" 一开始没在意数据范围...就用一个5行的dfs瞎做,搞了80分。 正解是带权并查集,只需要维护一下到根节点的距离就可以了。。。。 cpp include define N 200005 using namespace std; int n,father[N],to_root[N],ans 阅读全文
posted @ 2018-08-09 22:33 Patrickpwq 阅读(116) 评论(0) 推荐(0)