Python Backtracking Solution
set_g_or_b -> use backtracking method to find all possible combination of good and bad person. Configuration is valid if it doesn\'t lead to any contradiction. 
set_g_or_b -> use backtracking method to find all possible combination of good and bad person. Configuration is valid if it doesn\'t lead to any contradiction. \n\nin set_g_or_b, call find_bad to find bad people given the existing condition\nfind_bad-> use the conditon that x is bad or good to find all bad person:\n\t1. Once x is set to be bad, anyone says x is good is bad\n\t2. Once x is set to be good, anyone says x is bad is bad\n\t3. use visted_bad and visited_good to save found bad/good person, a person can only in one set\n\n\n```\nclass Solution:\n    def maximumGood(self, statements: List[List[int]]) -> int:\n        pointed_good_by = collections.defaultdict(set)\n        pointed_bad_by = collections.defaultdict(set)\n        \n        for i in range(len(statements)):\n            for k in range(len(statements[i])):\n                if statements[i][k] == 1:\n                    pointed_good_by[k].add(i)\n                if statements[i][k] == 0:\n                    pointed_bad_by[k].add(i)\n    \n\n        def find_bad(i):\n            if i in self.visited_good:\n                return False\n            if i in self.visited_bad:\n                return True\n            self.visited_bad.add(i)\n            for k in pointed_good_by[i]:\n                if not find_bad(k):\n                    return False\n            return True\n \n        self.res = 0\n        \n        def set_g_or_b(i, f):\n            if f == True:\n                self.visited_good.add(i)\n                for k in pointed_bad_by[i]:\n                    if not find_bad(k):\n                        return\n            else:\n                if not find_bad(i):\n                    return\n\n            if i == len(statements) -1:\n                self.res = max(self.res, len(statements) - len(self.visited_bad))\n                return\n                \n            tp_good = copy.deepcopy(self.visited_good)\n            tp_bad = copy.deepcopy(self.visited_bad)\n            if i + 1 not in self.visited_bad:\n                set_g_or_b(i + 1, True)\n            self.visited_good = copy.deepcopy(tp_good)\n            self.visited_bad = copy.deepcopy(tp_bad)\n            if i + 1 not in self.visited_good:\n                set_g_or_b(i + 1, False)\n\n        \n        self.visited_bad = set()\n        self.visited_good = set()\n        set_g_or_b(0, True)\n        self.visited_bad = set()\n        self.visited_good = set()\n        set_g_or_b(0, False)\n \n        return self.res\n\t```
['Backtracking']