Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

MLE和TLE可能是这样造成的(见内)

Posted by fantasyorz at 2010-02-25 00:06:07 on Problem 1703
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator