并查集
文章平均质量分 77
_OS
江上白衣凌云
展开
-
HDU - 3635 Dragon Balls
#include #include #include #include using namespace std; int f[10005],ti[10005]; int find(int x) { if(f[x]<0) return x; else { int tt=f[x]; f[x]=find(f[x]); ti[x原创 2014-01-26 00:30:28 · 535 阅读 · 0 评论 -
FZU 2155 删点并查集
题意:就是纯裸的合并和删除一个点 解法:设立虚拟节点就好了原创 2014-08-02 13:26:37 · 605 阅读 · 0 评论 -
zoj 3641 并查集+set
题意:有一个教室 然后每个同学会知道一些信息 然后老师监视着他们 给出mei c原创 2014-08-01 15:59:23 · 502 阅读 · 0 评论 -
LA3644 并查集判环
A secret service developed a new kind of explosive that attain its volatile property only when a specific association of products occurs. Each product is a mix of two different simple compounds, to原创 2014-08-01 16:48:20 · 443 阅读 · 0 评论 -
hdu2473 删点并查集
题意:典型并查集的操作 合并两个点 从指定的集合中原创 2014-07-30 22:54:35 · 856 阅读 · 0 评论 -
hdu4424 并查集+贪心
题意:有一棵树,树上任意亮点容量的定义是路径上的zui xi原创 2014-08-02 14:11:50 · 693 阅读 · 0 评论 -
LA3027 带权并查集
题意:并查集的操作合并 a,b 每个点都有一个权 然后liang原创 2014-08-01 21:32:48 · 394 阅读 · 0 评论 -
HDU3172 Virtual Friends
纯裸的并查集 #include #include #include #include #include using namespace std; #define M 200005 int f[M]; int find(int x) {return f[x]<0?x:f[x]=find(f[x]);} int uni(int fx,int fy) { int ans=f[fx]+f[fy原创 2014-01-26 15:17:54 · 497 阅读 · 0 评论 -
HDU3038 How Many Answers Are Wrong
对比一下重力势能一下子就想通了 根节点的权值就相当于势能的零点 然和每次插入的时候判断是否和当前的值冲突就行#include #include #include using namespace std; #define M 200005 int sum[M],f[M]; int find(int x) { if(f[x]==x) return x; else {原创 2014-01-26 14:37:57 · 506 阅读 · 0 评论 -
hdu4912 贪心+lca
题意:给出一些树边组成一棵树,再给出路径原创 2014-08-08 16:01:04 · 433 阅读 · 0 评论