Reducing Run Time

Revision en3, by love_you_ma, 2015-08-08 04:30:21

**Hi. A few days ago I have solved a Problem on UVa named Virtual Friends .

The link is here : Click Here .

This is a Union Find / Disjoint Set Find problem . I used that algorithm and Got Accepted verdict at 2.281 Sec. Although the problem says it's Time Limit is 10 Sec. May be the data set is Huge. I have seen the Best Submission ever for this problem is 0.104 Sec.

Now my Question is how to decrease my Run Time?? I want to get Accepted verdict less than 1 Sec. How to optimize my Code ??

My Code is : http://ideone.com/34YqH9

Thanks is Advance.**

Tags uva 11503, less run time

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English love_you_ma 2015-08-08 04:30:21 13
en2 English love_you_ma 2015-08-08 04:26:30 5 Bold Tag Added.
en1 English love_you_ma 2015-08-08 04:25:28 635 Initial revision (published)