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 |
写kluskal WA的人注意下我是因为 i=cnt=0; while(cnt<n-1-q) { if( getf(e[i].a) != getf(e[i].b) ) { unite(e[i].a,e[i].b); sum+=e[i].p; cnt++; } i++; } while里面的条件应该为错了,应该注意已经修好的q条路中有可能是环路,所以我改为(cnt<n-1)就过了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator