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 zzyzzy12 at 2012-02-13 11:08:35 on Problem 1703 and last updated at 2012-02-13 11:12:47
大家很多都是并查集~~用father[]可以不断指向集合标志数...用另外一个数组s[]可以指向这个集合所相对的那个集合标志数..
大家在D x y时判断合并x,y的集合时..一定要注意..
         不仅    x=getfahter(x);       y=getfather(y); 
         同样 s[x]=getfather(s[x]); s[y]=getfather(y)
我就是因为s[]没有做对~~就MLE了好久..我是用递归写的getfather..若使用迭代..没更新s[]会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