摘要: poj 1330 裸LCA#define M 10005int parent[M]; // 根节点int Find(int i){ int j; for(j = i; j != parent[j]; j = parent[j]); while(i != j){ int temp = parent[i]; parent[i] = j; i = temp; } return j;}void Union(int a, int b){ int x = Find(a), y = Find(b); if(x == y) return... 阅读全文
posted @ 2013-06-26 20:25 心向往之 阅读(167) 评论(0) 推荐(0) 编辑