基本数据结构:堆栈,队列,堆,并查集
zhenggy_
爱生活,爱编程
展开
-
POJ 2524 Ubiquitous Religions //简单并查集
Ubiquitous Religions Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 24528 Accepted: 12087 Description There are so many different religions in the world t原创 2014-08-19 15:34:03 · 515 阅读 · 0 评论 -
Corporative Network LA3027
#include #include #include #include int f[20500][2]; void inser(int x, int y) { f[x][0] = y; f[x][1] = abs(x-y)%1000; } int find(int x) { int tmp; if(f[x][0] != x) {原创 2015-03-15 16:17:11 · 520 阅读 · 0 评论 -
poj 1182 食物链 //带权并查集
#include int ani[55000], rel[55000]; void init(int n) { int i; for(i=0; in; i++) { ani[i] = i; rel[i] = 0;} } int findd(int x) { int fx; if(x == ani[x]) return x; fx = ani[x]; ani[x] = find原创 2014-11-25 13:46:24 · 577 阅读 · 0 评论