
ACM水题之路—并查集
a342374071
这个作者很懒,什么都没留下…
展开
-
HDU 1273 小希的迷宫
<br />刚开始我天真的以为是用图论做的,最后一直MLE我就很蛋疼,我说用MAP和string 映射怎么他妈就要错呢。。。真的倒塌,自己还是菜菜呀,认真学习中。。。<br />// by ashione 用<set>一直TLE 可能STL速度很慢吧,换成flag标记就好了。 #include<iostream> #include<cstdio> #include<set> using namespace std; #define M 100001 int root[M+1]; bool ma原创 2011-05-26 20:50:00 · 670 阅读 · 0 评论 -
HDU 1856 并查集
[code]#include#includeusingnamespacestd;#define M 1000001intnum[M],rote[M],Maxstep;voidinit(intMax){for(inti=0;i=num[b]){num[a]+=num[b];rote[b]=rote[a];Maxstep=Maxstep>num[a]?Maxstep:num[a];}else{num[b]+=num[a];rote[a]=rote[b];Maxstep=Maxstep>num[b]?Maxste原创 2011-05-25 15:49:00 · 580 阅读 · 0 评论 -
HDU 1116 Play on Words(并查集,欧拉回路)
<br />//ashione 2011-6-1 ,并查集,欧拉回路检测 #include<iostream> #include<cstring> using namespace std; #define SetMax 27 #define StringMax 1001 int set[SetMax],in[SetMax],out[SetMax],point[SetMax]; char temp[StringMax]; bool mark[SetMax],falg; int find(in原创 2011-06-01 21:16:00 · 577 阅读 · 0 评论