Stuck on SEAGRP problem

Hi,

i am trying to solve the SEAGRP problem by using the Tutte matrix approach.
I get WA all the time and cannot really find the problem in my code.

My code looks as follows:

Any suggestions would be appreciated.

Here’s my code with comments- http://www.codechef.com/viewsolution/3789678.
What i could not understand was basically how the gaussian elimination was working and so i commented that particularly!

Hope it helps!
Other resources to help understanding- http://discuss.codechef.com/questions/35358/seagrp-editorial
Tutte Matrix-Wikipedia
Gaussian Elimination- Wikipedia

Cheers!