摘要: 很有技巧的并查集 参考了别人的#include #include #include using namespace std; int high[30005], fa[30005], top[30005], ret[30005]; void init() { int i; for(i=0; i=0;i--) { high[ret[i]]+=high[fa[ret[i]]]; fa[ret[i]]=id; } return id; } int main() { int p, x, y, a, b; char o... 阅读全文
posted @ 2013-08-20 15:48 Ink_syk 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 并查集 过了#include #include #include using namespace std; bool pipe[][4]= {1,1,0,0, 0,1,1,0, 1,0,0,1, 0,0,1,1, 0,1,0,1, 1,0,1,0, 1,1,1,0, 1,1,0,1, 1,0,1,1, ... 阅读全文
posted @ 2013-08-20 15:43 Ink_syk 阅读(97) 评论(0) 推荐(0) 编辑