getting WA for GALACTIC.....

hi…i have checked my program for all the boundary conditions…
but still i am getting WA answer…please help me
`http://www.codechef.com/viewsolution/2397593
THANKYOU…

Thanks…rsaha77…
my program was failing for the test case
where any of the connected components having more than one planet have all weight < 0…

//