love_you_ma's blog

By love_you_ma, history, 9 years ago, In English

**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.**

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it