
并查集
zhouzhenghuac
这个作者很懒,什么都没留下…
展开
-
5-30 并查集 tree
#include #include using namespace std;ifstream fin("tree.in");ofstream fout("tree.out");#define cin fin#define cout foutint fa[100001];bool check[1000001];int u_f(int x){ int r原创 2016-08-04 20:24:32 · 265 阅读 · 0 评论 -
6-6 并查集练习——friend
#include #include #include using namespace std;int fa[100001];ifstream fin("friend.in");ofstream fout("friend.out");#define cin fin#define cout foutint u_f(int x) //(和tree一样) 并查集的原创 2016-08-04 20:24:35 · 338 阅读 · 0 评论 -
6-6 并查集练习——ttime
#include #include #include using namespace std;ifstream fin("ttime.in");ofstream fout("ttime.out");#define cin fin#define cout foutint fa[100001];int u_f(int x){ int root=x;原创 2016-08-04 20:24:38 · 245 阅读 · 0 评论 -
tree 用点、边的算法
由于江老师说上次那个算法是以前的,所以我就用了新学的计算边数与点数的算法……程序:<span lang="EN-US" style="font-size:14.0pt;font-family:Consolas;mso-bidi-font-family:Consolas;color:green;mso-font-kerning:0pt;" >#include <span lang="原创 2016-08-04 20:24:41 · 263 阅读 · 0 评论 -
galaxy 原来的方法——超时(没有压缩路径)
因为没有压缩路径,因此访问每一个成员的根会十分的慢,因此十分容易超时(因为超时,所以不知道对不对……)#include #include #include using namespacestd; ifstreamfin("galaxy.in"); ofstreamfout("galaxy.out"); #definecin fin #definecou原创 2016-08-04 20:24:44 · 314 阅读 · 0 评论 -
6-17 创新班第十课
首先,江老师评价了一下我们的博客,说我的tree那题没有用新学的方法做,所以我就在博客上贴了程序 在这里,江老师讲了两个很重要的概念: 1、静态和动态: 按照tree那题来举例:按照杨鸿飞的方法压缩路径就是属于静态,而用我们学的方法就是属于动态:静态:原创 2016-08-04 20:24:46 · 306 阅读 · 0 评论 -
爆炸化合物(explosion)
这题按照江老师告诉我们探索题目的方法,我就列举了一些不能上车的一些例子:<span lang="EN-US" style="font-size:12.0pt;font-family:宋体;mso-bidi-font-family:宋体;mso-font-kerning:0pt;" ><table class="MsoTableGrid" border="1" cellsp原创 2016-08-04 20:24:49 · 976 阅读 · 0 评论 -
water 参考程序
#include #include #include using namespace std;ifstream fin("water.in");ofstream fout("water.out");#define cout fout#define cin finstruct Tnode{ int copy; int self; int fa; char c; int root;};Tnode a[原创 2016-08-04 20:24:54 · 281 阅读 · 0 评论 -
并查集 5-30 tree ------错误方法
#include using namespace std;int fa[100000];// fatherint f_u(int x){int root=x;while(fa[root]!=root) root=fa[root];while(fa[x]!=x){int y=fa[x];fa[x]=root;x=y; }return root;原创 2016-08-04 20:24:29 · 214 阅读 · 0 评论