| ||||||||||
| 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:并查集老是WA,哪位帮忙看下代码。。In Reply To:并查集老是WA,哪位帮忙看下代码。。 Posted by:yayu_myself at 2009-12-27 10:44:03 我把
if (pre[a] > pre[b])
{
pre[b] += pre[a];
pre[a] = b;
}
else
{
pre[a] += pre[b];
pre[b] = a;
}
改为
if( pre[a] < pre[b] )
{
pre[a] += pre[b];
pre[b] = a;
}
else
{
pre[b] += pre[a];
pre[a] = b;
}
就过了。。郁闷死。。
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator