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:MLE和TLE可能是这样造成的(见内)In Reply To:MLE和TLE可能是这样造成的(见内) Posted by:fantasyorz at 2010-02-25 00:06:07 > ra = find( a ); // 求a的根节点 > rb = find( b ); // 求b的根节点 > if ( ra != rb ) // * > unionSets( a, b, ra, rb ); > 如果不判断ra和rb,当ra == rb时: parent[ ra ] = rb; > 1. 若你的find函数是用递归写的,将会导致无限递归==>MLE > 2. 若你的find函数是用迭代写的,将会导致无限循环==>TLE Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator