| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:哪里错了啊 请大牛指点In Reply To:哪里错了啊 请大牛指点 Posted by:tangbohu222 at 2011-03-26 15:52:09 for(int j=1;j<=N;j++)//
{
if(father[j]==temp)
father[j]=father[temp];
}
这里有问题,,,,temp不仅仅代表的是一个点,,,是一个集合,,,你这样做,,,仅仅是把temp这个集合里的最父亲节点的孩子更新了,,,这个集合里其他节点的孩子没有更新,,,因为我也犯了这个错误,,,
另外应避免精度问题,,,
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator