Submask
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& state) {\n        int m = state.size();\n        function<bool(int)> valid = [&](int n) {\n            for (int i = 0; i < m; i++) {\n                if ((n>>i)&1) {\n                    // assume person is good;\n                    // check statement of person i about j person\n                    for (int j = 0; j < m; j++) {\n                        if (j == i) continue;\n                        bool jth = (n>>j)&1;\n                        // person good always tell the truth\n                        // jth is good and person i tell bad or jth is bad and person i tell good => person i is not good\n                        if (state[i][j] == 0 && jth || state[i][j] == 1 && !jth) return false;\n                    }\n                }\n            }\n            return true;\n        };\n        // assume n of m people are good\n        int ans = 0;\n        for (int i = 1; i < (1<<m); i++) {\n            if (!valid(i)) continue;\n            int cnt = __builtin_popcount(i);\n            ans = max(ans, cnt);\n        }\n        return ans;\n    }\n};\n```
['Bitmask', 'C++']