摘要: 并查集删点就是弄个id记录当前点的id,删除的时候将id设为新的id,忽略原来的id,当然还要注意去改变原来集合需要维护的性质比如元素个数等等。 这题的坑点在于第二个操作,把u放在u所在集合的时候直接忽略,而不是把u拿出来。 阅读全文
posted @ 2016-03-17 11:41 __560 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 数据结构: http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=676&pid=1003 http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php 阅读全文
posted @ 2016-03-17 09:37 __560 阅读(281) 评论(0) 推荐(0) 编辑