2012年8月31日

种类并查集

摘要: #include <iostream>using namespace std;const int M = 50000 + 10;struct Node{ int father; int kind;}node[M];void Init(int n){ for (int i = 1; i <= n; i++) { node[i].father = i; node[i].kind = 0; }}//int Find(int x){ if (x == node[x].father) { return x; } ... 阅读全文

posted @ 2012-08-31 20:10 [S*I]SImMon_WCG______* 阅读(735) 评论(0) 推荐(0) 编辑

POJ 1182 食物链(种类并查集)

摘要: 题目:http://poj.org/problem?id=1182#include <iostream>using namespace std;const int M = 50000 + 10;struct Node{ int father; int kind;}node[M];void Init(int n){ for (int i = 1; i <= n; i++) { node[i].father = i; node[i].kind = 0; }}//int Find(int x){ if (x == node[x].fat... 阅读全文

posted @ 2012-08-31 20:09 [S*I]SImMon_WCG______* 阅读(194) 评论(0) 推荐(0) 编辑

导航