I solved the problem MIKE3 which is giving me a correct answer for all random test cases i give to it but the OJ is giving me a WA for some reasons. here is my solution non documented version or documented version on pastebin

In the solution which is documented enough for a good understanding i have reduced the problem to find the sets of the group(offers) which cant be dealt with together and used an array named graph to store this to find the solution.

Help find the error in this algorithm/code !