Short C++ code
\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& A) {\n        int count = std::count(A.begin(), A.end(), 1);\n        if(count % 3)\n 
```\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& A) {\n        int count = std::count(A.begin(), A.end(), 1);\n        if(count % 3)\n            return {-1, -1};\n        count /= 3;\n        int i = 0,j = 1,k = 2;\n        for(int l = 0, cnt = 0; l < A.size(); cnt += A[l], ++l){\n            if(cnt == 0 && A[l] == 1)\n                i = l;\n            if(cnt == count && A[l] == 1)\n                j = l;\n            if(cnt == 2 * count && A[l] == 1)\n                k = l;\n        }\n        for(; k < A.size(); ++i, ++j, ++k)\n            if(A[i] != A[j] || A[i] != A[k])\n                return {-1, -1};\n        return {i - 1, j};\n    }\n};\n```
[]