C++ solution
\nclass Solution {\npublic:\n    bool stoneGameIX(vector<int>& stones) {\n        int n = stones.size();\n        int zero = 0;\n        int one = 0;\n        i
```\nclass Solution {\npublic:\n    bool stoneGameIX(vector<int>& stones) {\n        int n = stones.size();\n        int zero = 0;\n        int one = 0;\n        int two = 0;\n        for (int i = 0; i < n; i++) {\n            if (stones[i] % 3 == 0) ++zero;\n            else if (stones[i] % 3 == 1) ++one;\n            else ++two;\n        }\n        if (one == 0 && two == 0) return false;\n        if (one == 0) {\n            if ((zero + 1) % 2 == 0) {\n                if (two - 1 <= 1) return false;\n                return true;\n            }\n            return false;\n        }\n        else if (two == 0) {\n            if ((zero + 1) % 2 == 0) {\n                if (one - 1 <= 1) return false;\n                return true;\n            }\n            return false;\n        }\n        if ((zero + 1) % 2 == 0) {\n            if (two - 2 >  one) {\n                return true;\n            }\n            if (one - 2 > two) return true;\n        }\n        else {\n            if (one - 2 < two) return true;\n            if (two - 2 < one) return true;\n        }\n        return false;\n        \n    }\n};\n```
[]