摘要: 传送门 : https://www.patest.cn/contests/gplt/L2-010 朋友之间的关系和敌对的关系分别用并查集和二维数组储存。 AC code : 阅读全文
posted @ 2017-03-09 21:44 codinRay 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 : http://acm.hdu.edu.cn/showproblem.php?pid=1232 并查集的裸题 AC code: 阅读全文
posted @ 2017-03-09 21:38 codinRay 阅读(136) 评论(0) 推荐(0) 编辑
摘要: int pre[MAXN]; int Find(int pos) { if (pre[pos] == pos) // pre是自己,代表为root节点 return pos; int r = pos; while (r != pre[r]) // 找到节点pos的root r = pre[r]; // 路径压缩 ... 阅读全文
posted @ 2017-03-09 19:46 codinRay 阅读(91) 评论(0) 推荐(0) 编辑